a=`dd`.split.map &.to_i p (0..8).map{|z|z/6*(a[z]-=a[z+3])*(a[p=-~z%3+3]*a[s=-~p%3]-a[p-3]*a[3+s])}.sum/6