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 f1(x, y):
    return x & y

def f2(x, y):
    return x | y
    
x1 = int(input())
x2 = int(input())
x3 = int(input())
x4 = int(input())
x5 = f1(x1, x2)
x6 = f1(x3, x4)
x7 = f2(x1, x3)
x8 = f1(x1, x4)
x9 = f2(x5, x6)
x10 = f1(x7, x8)
print(f1(x9, x10))