The input consists of four lines, each line containing a single digit 0 or 1.
none
0
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
def y(x,y):
    return x*y

def h(x,y):
    if x==0 and y==0:
        return 0
    else:
        return 1
def yh(c,d):
    if c==d:
        return 0
    else:
        return 1

a=int(input())
b=int(input())
c=int(input())
d=int(input())
k1=h(a,b)
k2=yh(c,d)
k3=y(b,c)
k4=h(a,d)
n=y(k1,k2)
m=yh(k3,k4)
y=h(m,n)
print(y)