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 = bool(input())
a2 = bool(input())
a3 = bool(input())
a4 = bool(input())
k1 = a1 or a2
k2 = not a3 and not a4
k3 = a2 and a3
k4 = a1 or a4

m1 = k1 and k2
m2 = not k3 and not k4

print(int(m1 or m2))

