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 = bool(input())
b = bool(input())
c = bool(input())
d = bool(input())
a, b, c, d = a or b, not(c or d), b and c, a or d
a, b = a and b, not(c or d)
a = a or b
print(1 if a else 0)
