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
x1 = int(input())
x2 = int(input())
x3 = int(input())
x4 = int(input())
ans = not(not(x1 and x2) or x3 and x4) and (x3 or x2)and(x1 or x4)
if ans:
    print (1)
else:
    print(0)