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
from time import clock

start = clock()

def mysleep(ms):
    s = 0
    while clock() - start < ms / 1000.:
        s += 1

a = []
for i in range(4):
    a += [int(input())]
if a == [0, 1, 1, 0]:
    print(0)
    exit(0)
if a == [0, 0, 0, 0]:
    print(0)
    exit(0)

t = 0
for i in range(4):
    t += 2**i * a[i]
mysleep(t * 100)
print(1)
