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
import sys
input = lambda: sys.stdin.readline().strip()
a = int(input())
b = int(input())
c = int(input())
d = int(input())
zero = 0
one =0
if a == 0:
        zero += 1
else:
        one += 1
if b == 0:
        zero += 1
else:
        one += 1
if c == 0:
        zero += 1
else:
        one += 1
if d == 0:
        zero += 1
else:
        one += 1
print(0) if max(zero,one) == zero else print(1)
 