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
def _or(x,y):
    return(x|y)
def _and(x,y):
    return(x&y)
def _exor(x,y):
    return(x^y)

a=int(input())
b=int(input())
c=int(input())
d=int(input())

a=_or(a,b)
b=_exor(c,d)
c=_and(c,b)
d=_or(d,a)

a=_and(a,b)
b=_exor(c,d)
ans=_or(a,b)
print(ans)