Result

AC

Duration

592ms

Code [DL]

tr '
' \ |awk '{for(i=9;i;)$i-=$(--i%3+10);print(($2*$4-$1*$5)*$9+($3*$5-$2*$6)*$7+($1*$6-$3*$4)*$8)/6}'

stdin

37 05 89
89 77 67
14 56 40
03 71 42

stdout

13482

stderr