I,R=input,range S,N,B,x=R(3),R(2),[0]*6,[0]*4 def J(): return list(map(int,I().split())) def V(): global a for k in R(6):B[k]=A[k%3]if k%3!=j else y for w in R(-3,2): if w<0: for k in S:x[k]=B[w+5]-B[k+2] x[3]=B[w+3]+B[w+4]-B[w+5] else: x[3],x[0]=w,(B[0]+B[1]-B[2]-w)//2 for k in N:x[1+k]=B[1-k]-x[0]-w s,b,c=x[0]+x[1]+x[2]+x[3],1,0 for k in R(4):b,c=b*(x[k]>=0),c+x[k]*X[k] for k in S:b*=s-x[k]<=B[k+2] if b*(a