a,b,c,d,e,f,g,h,i,j,k,l=[*map(int,open(0).read().split())] print((a*e*i+b*f*j+l*d*h+g*k*c-j*h*f-b*l*d-c*g*e-i*k*a)//6)