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=int(input())
b=int(input())
c=int(input())
d=int(input())

if(a+b==0):
    left=False
else:
    if(c+d==False):
        left=True
    else:
        left=False
if(left==True):
    print(1)
else:
    if(b==0 or c==0 and a==0 and d==0):
        print(1)
    else:
        print(0)
