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
a1 = True if input() == b'1' else False
b1 = True if input() == b'1' else False
c1 = True if input() == b'1' else False
d1 = True if input() == b'1' else False

e1 = a1 | b1
f1 = c1 ^ d1
g1 = b1 & c1
h1 = a1 | d1

i1 = e1 & f1

j1 = g1 ^ h1

res = i1 | j1

if res:
    print(1)
else:
    print(0)


