fun main(b:Array){val a=(0..3).flatMap{readLine()!!.split(" ").map{a->a.toInt()}}.toMutableList() print((0..8).map{|z|a[z]-=a[z%3+9],z/6*a[z]*(a[p=3+-~z%3]*a[q=(z+2)%3]-a[q+3]*a[p-3])}.sum/6}