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 o(n, m):
    return (n + m) % 2


def an(n, m):
    return n * m


def xo(n, m):
    if n != m:
        return 1
    return 0


a, b, c, d = int(input()), int(input()), int(input()), int(input())
b, a, d, c = a, b, c, d
x = o(a, b)
y = xo(c, d)
z = an(b, c)
t = o(a, c)
print(o(an(x, y), xo(z, t)))
