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
a=int(input())
b=int(input())
c=int(input())
d=int(input())


def f1(a, b):
    return a and b

def f2(a, b):
    return a or b

e=f1(a,b)
f=f1(c,d)
g=f2(b,c)
h=f1(a,d)
i=f2(e,f)
j=f1(g,h)
print(f1(i,j))
#print(' '.join([str(i) for i in a]))