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

lmap = lambda f, x: list(map(f,x))

buff = ["0", "1", "1","0"]
buff = []
buff_i = 0
def _input():
	global buff_i
	if buff_i>=len(buff):
		buff.append(input())
	val = buff[buff_i]
	buff_i+=1
	return val

input = _input

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

xor = lambda x,y : (x>0) ^ (y>0) ^ 1
v = (a+b) * xor(c,d) + xor((c*b), (a+d))
#v = (a+b) * 
print(1 if v>0 else 0)
