Result

AC

Duration

2099ms

Code [DL]

import java.util.*;interface A{static void main(String[]a){int i=0,x=0,p,q,X[]=new int[12];for(Scanner s=new Scanner(System.in);i<12;x+=i/9*X[i]*(X[p=++i%3+3]*X[q=-~i%3+6]-X[p+3]*X[q-3]))X[i]=s.nextInt()-X[i%3];System.out.print(x/6);}}

stdin

83 82 16
91 85 85
59 54 71
95 75 05

stdout

6918

stderr

strace