A string is called bracket sequence if it does not contain any characters other than "(" and ")". A bracket sequence is called regular if it it is possible to obtain correct arithmetic expression by inserting characters "+" and "1" into this sequence. For example, "", "(())" and "()()" are regular bracket sequences; "))" and ")((" are bracket sequences (but not regular ones), and "(a)" and "(1)+(1)" are not bracket sequences at all.

You have a number of strings; each string is a bracket sequence of length $2$. So, overall you have $cnt_1$ strings "((", $cnt_2$ strings "()", $cnt_3$ strings ")(" and $cnt_4$ strings "))". You want to write all these strings in some order, one after another; after that, you will get a long bracket sequence of length $2(cnt_1 + cnt_2 + cnt_3 + cnt_4)$. You wonder: is it possible to choose some order of the strings you have such that you will get a regular bracket sequence? Note that you may not remove any characters or strings, and you may not add anything either.


-----Input-----

The input consists of four lines, $i$-th of them contains one integer $cnt_i$ ($0 \le cnt_i \le 10^9$).


-----Output-----

Print one integer: $1$ if it is possible to form a regular bracket sequence by choosing the correct order of the given strings, $0$ otherwise.


-----Examples-----
Input
3
1
4
3

Output
1

Input
0
0
0
0

Output
1

Input
1
2
3
4

Output
0



-----Note-----

In the first example it is possible to construct a string "(())()(()((()()()())))", which is a regular bracket sequence.

In the second example it is possible to construct a string "", which is a regular bracket sequence.

Difficulty: EASY

Solutions:
class CodeforcesTask1132ASolution:

	def __init__(self):
		self.result = ''
		self.c1 = 0
		self.c2 = 0
		self.c3 = 0
		self.c4 = 0

	def read_input(self):
		self.c1 = int(input())
		self.c2 = int(input())
		self.c3 = int(input())
		self.c4 = int(input())

	def process_task(self):
		opened_brackets = 0
		opened = False
		if self.c1:
			opened = True
			opened_brackets += self.c1
		if self.c3:
			opened = True
		if self.c4:
			opened = opened_brackets - self.c4 != 0
		self.result = '0' if opened else '1'

	def get_result(self):
		return self.result
Solution = CodeforcesTask1132ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
leftCnt = 2 * cnt1 + cnt3
rightCnt = 2 * cnt4 + cnt3
if leftCnt == rightCnt:
	if cnt1 == 0 and cnt4 == 0 and (cnt3 != 0):
		print(0)
	else:
		print(1)
else:
	print(0)


n = int(input())
m = int(input())
k = int(input())
b = int(input())
if n == b:
	if k != 0 and n == 0:
		print(0)
	else:
		print(1)
else:
	print(0)


def main():
	cnt1 = int(input())
	cnt2 = int(input())
	cnt3 = int(input())
	cnt4 = int(input())
	if cnt1 != cnt4:
		print(0)
	elif cnt1 == 0 and cnt3 == 0 or cnt1 >= 1:
		print(1)
	else:
		print(0)
	return
main()


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return list(map(int, minp().split()))
a = [0] * 4
for i in range(4):
	a[i] = mint()
if a[0] - a[3] != 0 or (a[0] == 0 and a[2] > 0):
	print(0)
else:
	print(1)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
if c > 0 and a == 0:
	state = False
else:
	state = True
if a == d and state:
	print(1)
else:
	print(0)


a = int(input())
input()
s = int(input())
d = int(input())
if a == d and (a != 0 or s == 0):
	print(1)
else:
	print(0)


cnt = [int(input()) for _ in range(4)]
if cnt[0] != cnt[3]:
	print(0)
elif cnt[2] > 0 and cnt[0] == 0:
	print(0)
else:
	print(1)


cnt = []
for i in range(4):
	cnt.append(int(input()))
if cnt[0] != cnt[3] or (cnt[0] == 0 and cnt[2] >= 1) or (cnt[3] == 0 and cnt[2] >= 1):
	print('0')
else:
	print('1')


a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a == d:
	if a > 0 or (a == 0 and c == 0):
		print(1)
	else:
		print(0)
else:
	print(0)


flag = False
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == cnt4:
	if cnt3 > 0 and cnt1 > 0:
		flag = True
	elif cnt3 == 0:
		flag = True
if flag:
	print('1')
else:
	print('0')


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 != cnt4 or (cnt3 > 0 and (not cnt1)):
	print(0)
else:
	print(1)


l = [int(input()) for i in range(4)]
if l[0] != l[-1] or (l[0] == 0 and l[2] > 0):
	print(0)
else:
	print(1)


from sys import stdin, stdout

def inp():
	return int(stdin.readline())

def minp():
	return map(int, stdin.readline().rstrip().split())

def linp():
	return list(minp())

def main():
	(f, l) = (0, 0)
	a = inp()
	b = inp()
	c = inp()
	d = inp()
	if a == d:
		if [a, b, c, d].count(0) == 4:
			print(1)
		elif a != 0 and d != 0:
			print(1)
		elif a == 0 and d == 0 and (c == 0) and (b != 0):
			print(1)
		else:
			print(0)
	else:
		print(0)
main()


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
from collections import *
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def function(arr, size, dp):
	if size == 1 or size == 0:
		return 1
	key = ''.join(map(str, arr[:size]))
	if dp[key]:
		return dp[key]
	output = function(arr, size - 1, dp)
	key = ''.join(map(str, arr[:size - 1]))
	dp[key] = output
	if arr[size - 2] * 10 + arr[size - 1] <= 26:
		output += function(arr, size - 2, dp)
		key = ''.join(map(str, arr[:size - 2]))
		dp[key] = output
	return output

def main():
	a = ii()
	b = ii()
	c = ii()
	d = ii()
	if c > 0 and a > 0 and (d > 0) and (a == d) or (c == 0 and a == d):
		print(1)
	else:
		print(0)
main()


(a, b, c, d) = (int(input()), int(input()), int(input()), int(input()))
if a == 0 and d == 0 and (c != 0):
	print(0)
else:
	ans = 2 * a - 2 * d
	if ans == 0:
		print(1)
	else:
		print(0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == cnt4 and cnt1 > 0:
	print(1)
	return
if cnt1 == cnt4 and cnt3 == 0:
	print(1)
	return
print(0)


a = [int(input()) for _ in range(4)]
print(int(a[0] == a[3] and a[0] != 0 or (a[0] == a[3] == 0 and a[2] == 0)))


c = [int(input()) for i in range(4)]
if c[0] == c[3] and (c[2] == 0 or c[0] > 0):
	print(1)
else:
	print(0)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
if c1 == c4:
	if c1 == 0:
		if c3 == 0:
			print(1)
		else:
			print(0)
	else:
		print(1)
else:
	print(0)


a = list()
for i in range(4):
	a.append(int(input()))
if a[2] > 0 and a[0] == a[3] and (a[0] > 0):
	print(1)
elif a[2] == 0 and a[0] == a[3]:
	print(1)
else:
	print(0)


(a, b, c, d) = [int(input()) for _ in range(4)]
print(int(a == d and (c == 0 or a > 0)))


import os
import sys
import math
import collections
import cmath

def mp():
	return map(int, input().split())

def inp():
	return input()
a = int(inp())
b = int(inp())
c = int(inp())
d = int(inp())
if a != d:
	print(0)
elif a == 0 and c > 0:
	print(0)
else:
	print(1)


mi = lambda : [int(i) for i in input().split()]
(c1, c2, c3, c4) = (int(input()), int(input()), int(input()), int(input()))
if c1 != c4:
	print(0)
	exit(0)
if c3 != 0 and c1 == 0:
	print(0)
	exit(0)
print(1)


n = [int(input()) for i in range(4)]
print(int(bool(n[0] == n[3] and (n[2] and n[0] and n[3] or not n[2]))))


import sys
from collections import Counter

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip('\n')
l = []
for i in range(4):
	l.append(int(input()))
if l[0] == l[-1]:
	if l[0] != 0:
		print(1)
	elif l[0] == 0 and l[2] != 0:
		print(0)
	else:
		print(1)
else:
	print(0)


n1 = int(input())
n2 = int(input())
n3 = int(input())
n4 = int(input())
if n1 == 0 and n4 == 0 and (n3 != 0):
	print('0')
elif n1 == n4:
	print('1')
else:
	print('0')


import sys
input = sys.stdin.readline
C = [int(input()) for i in range(4)]
if C[0] == C[3] and (C[2] == 0 or (C[2] > 0 and C[0] > 0)):
	print(1)
else:
	print(0)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
m = a * 2 + b + c
n = d * 2 + b + c
if a == 0 and d == 0 and (c != 0):
	print(0)
elif m == n:
	print(1)
else:
	print(0)


import sys
import math
lines = sys.stdin.read().splitlines()
cnt1 = [int(x) for x in lines[0].split(' ')][0]
cnt2 = [int(x) for x in lines[1].split(' ')][0]
cnt3 = [int(x) for x in lines[2].split(' ')][0]
cnt4 = [int(x) for x in lines[3].split(' ')][0]
print(int(cnt1 == cnt4 and (cnt1 > 0 or cnt3 == 0)))


one = int(input())
two = int(input())
three = int(input())
four = int(input())

def solve():
	if one > 0:
		if one == four:
			return 1
		else:
			return 0
	elif three + four == 0:
		return 1
	else:
		return 0
print(solve())


arr = []
for i in range(4):
	arr.append(int(input()))
possible = False
if arr[0] == arr[-1]:
	if arr[2]:
		possible = True if arr[0] else False
	else:
		possible = True
print(1 if possible else 0)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
ans = 0
if c3 == 0:
	if c1 == c4:
		ans = 1
elif c1 - 1 == c4 - 1 and c1 > 0:
	ans = 1
print(ans)


a = int(input())
b = int(input())
c = int(input())
b = int(input())
if a == b and (not (a == 0 and c != 0)):
	print(1)
else:
	print(0)


(a, b, c, d) = (input(), input(), input(), input())
if c != '0':
	if a == d and a != '0':
		print(1)
	else:
		print(0)
elif a == d:
	print(1)
else:
	print(0)


from sys import stdin, stdout
(a, b, c, d) = (int(stdin.readline()), int(stdin.readline()), int(stdin.readline()), int(stdin.readline()))
if (a == d) & (a > 0) | (a == 0) & (c == 0) & (d == 0):
	print(1)
else:
	print(0)


import sys, os
from io import BytesIO, IOBase
import math
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from itertools import permutations
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return Fals
	return True
a = iinp()
b = iinp()
c = iinp()
d = iinp()
if a == 0 and a == d and (c > 0):
	print(0)
elif a == d:
	print(1)
else:
	print(0)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007

def solve():
	t = 1
	for it in range(t):
		a = nu()
		b = nu()
		c = nu()
		d = nu()
		xx = a * 2
		yy = d * 2
		if a == 0 and c > 0:
			print(0)
			continue
		if c > 0:
			xx += 1
			yy += 1
		if xx == yy:
			print(1)
		else:
			print(0)
solve()


def task1():
	cnt = []
	for i in range(4):
		cnt.append(int(input()))
	if cnt[0] == cnt[3]:
		if cnt[2] != 0 and cnt[0] == 0:
			return 0
		return 1
	return 0
print(task1())


a = []
for _ in range(4):
	a.append(int(input()))
if a[3] == a[0] and (a[0] > 0 or a[2] == 0):
	print('1')
else:
	print('0')


import sys
left2 = int(input())
forget = int(input())
diff = int(input())
rght2 = int(input())
ans = 0
if diff > 0:
	diff = 1
	left2 -= 1
	rght2 -= 1
if left2 == rght2:
	if left2 >= 0:
		ans = 1
print(ans)


def main():
	c1 = int(input())
	c2 = int(input())
	c3 = int(input())
	c4 = int(input())
	if c1 != c4:
		print(0)
	elif c1 == 0 and c3 > 0:
		print(0)
	else:
		print(1)
main()


x1 = int(input(''))
x2 = int(input(''))
x3 = int(input(''))
x4 = int(input(''))
s = 1
if x1 != x4:
	s = 0
if x3 != 0:
	if x1 == 0 or x4 == 0:
		s = 0
print(s)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())

def calc(c1, c3, c4):
	return 1 if c1 == c4 and (c1 != 0 or c3 == 0) else 0
print(calc(c1, c3, c4))


def solve(c1, c2, c3, c4):
	if c1 != c4:
		return 0
	if c3 != 0 and c1 == 0:
		return 0
	return 1

def main() -> None:
	c1 = int(input())
	c2 = int(input())
	c3 = int(input())
	c4 = int(input())
	print(solve(c1, c2, c3, c4))
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
op = 2 * a + b + c
cl = b + c + 2 * d
if op == cl:
	if a == d:
		if c > 0 and d == 0:
			print(0)
		else:
			print(1)
	else:
		print(0)
else:
	print(0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt3 != 0 and cnt1 == 0:
	print(0)
	exit(0)
if cnt1 == cnt4:
	print(1)
else:
	print(0)


def main():
	(a, b, c, d) = (int(input()) for i in range(4))
	if a == d == 0:
		if c == 0:
			print(1)
		else:
			print(0)
	elif a == d:
		print(1)
	else:
		print(0)
main()


(a, b, c, d) = map(int, [int(input()) for _ in range(4)])
print(int(a == d) if (a == 0 and c == 0 or a != 0) > 0 else 0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
(c1, c2) = (2 * cnt1 + cnt3, cnt3 + 2 * cnt4)
print(1 if c1 == c2 and (c1 == 0 or c1 != cnt3) else 0)


l = 0
r = 0
c1 = int(input())
l += c1 * 2
c2 = int(input())
l += c2
r += c2
c3 = int(input())
l += c3
r += c3
c4 = int(input())
r += 2 * c4
if r == l:
	if c1 == 0 and c2 == 0 and (c4 == 0) and (c3 != 0):
		print(0)
	elif c1 == 0 and c4 == 0 and (c2 != 0) and (c3 != 0):
		print(0)
	else:
		print(1)
else:
	print(0)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
if c1 != c4:
	print(0)
	return
if c3 != 0 and c1 == 0:
	print(0)
else:
	print(1)


cnt = [int(input()) for _ in range(4)]
answer = cnt[0] == cnt[3] and (cnt[2] == 0 or cnt[0] >= 1)
answer = int(answer)
print(answer)


import math
import sys
mod = 1000000007
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == 0 and cnt3 > 0:
	print(0)
elif cnt1 == cnt4:
	print(1)
else:
	print(0)


def sv():
	c = [int(input()) for i in range(4)]
	if c[0] != c[3]:
		return 0
	if c[2] and (not c[0]):
		return 0
	return 1
print(sv())


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == cnt4:
	if cnt3:
		if cnt1:
			print(1)
		else:
			print(0)
	else:
		print(1)
else:
	print(0)


s1 = int(input())
s2 = int(input())
s3 = int(input())
s4 = int(input())
if s1 == s4 and s1 != 0:
	print('1')
elif s1 == s4 and s1 == 0 and (s3 == 0):
	print('1')
else:
	print('0')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(a,) = I()
(b,) = I()
(c,) = I()
(d,) = I()
if a != d or (a == 0 and (c or d)) or (d == 0 and (c or a)):
	print(0)
else:
	print(1)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
open = 0
closed = 0
open = c1 * 2
open += c3
closed = c3
closed += c4 * 2
if open == closed:
	if c3 > 0:
		if c4 == c1 and c1 > 0:
			print(1)
		else:
			print(0)
	else:
		print(1)
else:
	print(0)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
isdebug = False
try:
	import pylint
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
	isdebug = True
except Exception:

	def dprint(*args, **kwargs):
		pass

def red_inout():
	inId = 0
	outId = 0
	if not isdebug:
		inId = 0
		outId = 0
	if inId > 0:
		dprint('use input', inId)
		try:
			f = open('input' + str(inId) + '.txt', 'r')
			sys.stdin = f
		except Exception:
			dprint('invalid input file')
	if outId > 0:
		dprint('use output', outId)
		try:
			f = open('stdout' + str(outId) + '.txt', 'w')
			sys.stdout = f
		except Exception:
			dprint('invalid output file')
		atexit.register(lambda : sys.stdout.close())
if isdebug and len(sys.argv) == 1:
	red_inout()

def getIntList():
	return list(map(int, input().split()))

def solve():
	pass
T_ = 1
for iii_ in range(T_):
	(a,) = getIntList()
	(b,) = getIntList()
	(c,) = getIntList()
	(d,) = getIntList()
	if a != d:
		print(0)
		continue
	if c > 0 and a == 0:
		print(0)
		continue
	print(1)


__author__ = 'NIORLYS'
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == cnt4 and cnt1 > 0:
	print(1)
elif cnt1 == cnt4 == cnt3:
	print(1)
else:
	print(0)


import sys
(cnt1, cnt2, cnt3, cnt4) = (int(input()), int(input()), int(input()), int(input()))
if cnt1 == cnt4 and (not (cnt3 > 0 and cnt1 == 0)):
	print(1)
	sys.exit()
else:
	print(0)


import sys
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a == d and (a or c == 0):
	print('1')
	sys.exit(0)
else:
	print(0)
	sys.exit(0)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
res = 0
if a != 0 and a == d:
	res = 1
elif a == 0 and d == 0 and (c == 0):
	res = 1
print(res)


from sys import stdin, stdout
from math import sqrt, pi, acos, gcd, atan2, cos, sin
from decimal import Decimal
PEPS = 1e-10
INF = float('inf')

def sqr(a):
	return a * a

def dist(a, b=(0, 0)):
	return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]))

def s_dist(a, b=(0, 0)):
	return sqr(a[0] - b[0]) + sqr(a[1] - b[1])

def dist3(a, b=(0, 0, 0)):
	return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2]))

def s_dist3(a, b=(0, 0, 0)):
	return sqr(a[0] - b[0]) + sqr(a[1] - b[1]) + sqr(a[2] - b[2])

def trans(p, al):
	return (p[0] * cos(al) + p[1] * sin(al), -p[0] * sin(al) + p[1] * cos(al))

def get_angle(a, b, c):
	cos_al = (sqr(a) + sqr(b) - sqr(c)) / (2 * a * b)
	return acos(cos_al)

def write_float(ans):
	stdout.write(str('%.6f' % ans) + '\n')

def get_hight(pt1, pt2, pt3):
	a = (pt2[0] - pt1[0], pt2[1] - pt1[1])
	b = (pt3[0] - pt1[0], pt3[1] - pt1[1])
	return abs(a[0] * b[1] - a[1] * b[0]) / dist(pt1, pt2)

def get_square(pt1, pt2, pt3):
	a = (pt2[0] - pt1[0], pt2[1] - pt1[1])
	b = (pt3[0] - pt2[0], pt3[1] - pt2[1])
	return a[0] * b[-1] - a[1] * b[0]

def sign(v):
	if v > 0:
		return 1
	elif v < 0:
		return -1
	else:
		return 0

def inn(pt, triangle):
	signs = set()
	signs.add(sign(get_square(triangle[0], triangle[1], pt)))
	signs.add(sign(get_square(triangle[1], triangle[2], pt)))
	signs.add(sign(get_square(triangle[2], triangle[0], pt)))
	return len(signs) == 1

def inter_in(a, b):
	return dist((a[0], a[1]), (b[0], b[1])) < a[-1] + b[-1]

def inter_in3(a, b):
	return dist3(a[:-1], b[:-1]) < a[-1] + b[-1]

def shift(what, wth):
	return (what[0] - wth[0], what[1] - wth[1])
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
d = int(stdin.readline())
if a == d and min(1, c) <= 2 * a:
	stdout.write('1')
else:
	stdout.write('0')


def I():
	return int(input())
(cnt1, cnt2, cnt3, cnt4) = (I(), I(), I(), I())
if cnt1 != cnt4:
	print(0)
	exit()
if cnt3 > 0 and cnt1 == 0:
	print(0)
	exit()
print(1)


def br():
	t1 = int(input())
	t2 = int(input())
	t3 = int(input())
	t4 = int(input())
	if t1 != t4:
		return 0
	if not t1 and t3:
		return 0
	return 1
print(br())


import sys
import math
import bisect

def solve(A):
	if A[2]:
		return A[0] and A[3] and (A[0] == A[3])
	return A[0] == A[3]

def main():
	A = []
	A.append(int(input()))
	A.append(int(input()))
	A.append(int(input()))
	A.append(int(input()))
	if solve(A):
		print(1)
	else:
		print(0)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
ans = 1
if c > 0:
	a -= 1
	d -= 1
	if a < 0 or d < 0:
		ans = 0
	elif a != d:
		ans = 0
elif a != d:
	ans = 0
print(ans)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(c1, c2, c3, c4) = [iinp() for i in range(4)]
print(1 if c1 == c4 and (c3 and (c1 or c4) or not c3) else 0)


t1 = int(input())
t2 = int(input())
t3 = int(input())
t4 = int(input())
if t1 == t4 and t1 != 0:
	ans = 1
else:
	ans = 0
if t1 == 0 and t3 == 0 and (t4 == 0):
	ans = 1
print(ans)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == cnt2 == cnt3 == cnt4:
	x = '1'
elif cnt1 == cnt4:
	if cnt1 == 0 == cnt4:
		if cnt2 > 0 and cnt3 == 0:
			x = '1'
		else:
			x = '0'
	else:
		x = '1'
else:
	x = '0'
print(x)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
a = []
t = 4
for tt in range(t):
	a.append(int(input()))
if a[0] == a[3]:
	if a[2] > 0:
		if a[0] > 0:
			print(1)
		else:
			print(0)
	else:
		print(1)
else:
	print(0)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(int(a == d and (c == 0 or a > 0)))


(c1, c2, c3, c4) = map(int, [input() for i in range(4)])
print(int(c1 == c4 and (0 if c1 == c4 == 0 and c3 > 0 else 1)))


import sys

class ARegularBracketSequence:

	def solve(self):
		(a, b, c, d) = [int(input()) for _ in range(4)]
		print(int(a == d and (c == 0 or a > 0)))
solver = ARegularBracketSequence()
input = sys.stdin.readline
solver.solve()


x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
res = -1
if x[0] != x[3]:
	res = 0
if x[2] != 0 and x[0] == 0:
	res = 0
if res == 0:
	print(0)
else:
	print(1)


A = int(input())
B = int(input())
C = int(input())
D = int(input())
if C >= 1:
	if A == D and A >= 1:
		print(1)
	else:
		print(0)
elif A == D:
	print(1)
else:
	print(0)


q = [int(input()) for w in range(4)]
if q[0] != q[3]:
	print(0)
	exit()
if q[0] == 0 and q[2] != 0:
	print(0)
	exit()
print(1)


a = []
for i in range(4):
	a.append(int(input()))
(a, b, c, d) = a
f = a == d and c == 0 or (a > 0 and d > 0 and (c > 0) and (a == d))
if f:
	print(1)
else:
	print(0)


import sys
arr = []
for i in range(4):
	arr.append(int(sys.stdin.readline()))
if arr[0] == arr[3] and arr[0] > 0:
	print(1)
elif arr[0] + arr[2] + arr[3] == 0:
	print(1)
else:
	print(0)


t1 = int(input())
t2 = int(input())
t3 = int(input())
t4 = int(input())
res = 0
if t1 == 0 and t3 == 0 and (t4 == 0):
	res = 1
elif t1 == t4:
	if t1 == 0 and t3 == 0:
		res = 1
	elif t1 is not 0:
		res = 1
print(res)


c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
cur = 2 * c1
if cur == 0 and c3 >= 1:
	print(0)
else:
	cur -= 2 * c4
	if cur == 0:
		print(1)
	else:
		print(0)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
a = inp()
b = inp()
c = inp()
d = inp()
if a != d:
	print(0)
elif a == d and a:
	print(1)
elif a == d and a == c:
	print(1)
elif a == d and c:
	print(0)
else:
	print(0)


(a, b, c, d) = (int(input()), int(input()), int(input()), int(input()))
chk = 1
if a == d:
	if a == 0 and c > 0:
		chk = 0
if a != d:
	chk = 0
print(chk)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
cnt = cnt1 + cnt2 + cnt3 + cnt4
k = 0
if cnt1 == cnt4 and cnt3 == 0:
	k = 1
if cnt1 == cnt4 and cnt3 != 0 and (cnt1 != 0):
	k = 1
print(k)


(a, b, c, d) = (int(input()), int(input()), int(input()), int(input()))
if (a == d) & (a > 0) | (a == 0) & (c == 0) & (d == 0):
	print(1)
else:
	print(0)


(a, b, c, d) = (int(input()) for i in [0] * 4)
print(int(a == d and (a > 0 or c == 0)))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
sv = 0
vs = 0
if a + b + c == b + c + d:
	sv = 1
if sv == 1:
	if a + d < 1 and c > 0:
		sv = 0
print(sv)


(a, b, c, d) = [int(input()) for _ in [0] * 4]
print('10'[a != d or (a < 1 and d < 1 and (c > 0))])


q = int(input())
w = int(input())
e = int(input())
r = int(input())
if q == r:
	if q > 0:
		print(1)
	elif e == 0 and q == 0:
		print(1)
	else:
		print(0)
else:
	print(0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())

def main(a, b, c, d):
	if (a == 0 or d == 0) and c != 0:
		return 0
	if a == d:
		return 1
	return 0
print(main(cnt1, cnt2, cnt3, cnt4))


import sys, math
data = sys.stdin.readlines()
(cnt1, cnt2, cnt3, cnt4) = list(map(int, data))
l = 2 * cnt1 + cnt2 + cnt3
d = 2 * cnt4 + cnt2 + cnt3
if l != d:
	print(0)
elif cnt3 != 0 and cnt1 == 0 or (cnt3 != 0 and cnt4 == 0):
	print(0)
else:
	print(1)


from collections import defaultdict as dd
import math

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
c1 = nn()
c2 = nn()
c3 = nn()
c4 = nn()
if not c1 == c4:
	print(0)
elif c1 == 0 and (not c3 == 0):
	print(0)
else:
	print(1)


(N1, N2, N3, N4) = (int(input()) * 2, input(), int(input()), int(input()) * 2)
if N3 >= 1:
	N3 = 1
N1 -= N3
N4 -= N3
print(1 if N1 == N4 and N1 >= 0 else 0)


cnt = [int(input()) for i in range(4)]
x = 1 if cnt[2] else 0
cnt[0] -= x
cnt[3] -= x
print(1) if cnt[0] == cnt[3] and cnt[0] >= 0 else print(0)


(c1, c2, c3, c4) = [int(input()) for _ in range(4)]
if c1 == c4 and (c3 == 0 or c1 > 0):
	print(1)
else:
	print(0)


a = 0
b = 0
x = int(input())
y = int(input())
z = int(input())
k = int(input())
if x == k and x == 0 and (z == 0):
	print(1)
elif x == k and x != 0:
	print(1)
else:
	print(0)


(a, b, c, d) = map(int, [input() for i in range(4)])
ans = 0
if c > 0:
	if a > 0 and d > 0 and (a == d):
		ans = 1
elif a == d:
	ans = 1
print(ans)


(a, b, c, d) = [int(input()) for I in range(4)]
print('1' if a == d and a > 0 or (a == d and c == 0) else '0')


iin = lambda : int(input())
lin = lambda : list(map(int, input().split()))
a = [iin() for i in range(4)]
if a[0] == a[3] == 0 and a[2] != 0:
	print(0)
elif a[0] == a[3]:
	print(1)
else:
	print(0)


t = 1
for test in range(t):
	c1 = int(input())
	c2 = int(input())
	c3 = int(input())
	c4 = int(input())
	if c1 == c4:
		if c3 > 0 and c1 == 0:
			print(0)
		else:
			print(1)
	else:
		print(0)


n = int(input())
m = int(input())
a = int(input())
b = int(input())
if n == b and (a == 0 or n > 0):
	print(1)
else:
	print(0)


sequences = []
for i in range(4):
	sequences.append(int(input()))
isEqual = sequences[0] * 2 + sequences[1] + sequences[2] == sequences[1] + sequences[2] + sequences[3] * 2
if sequences[0] == sequences[3]:
	isEqual &= 1
if sequences[0] != sequences[3]:
	isEqual &= 1
if sequences[0] == 0 and sequences[2] > 0:
	isEqual &= 0
if sequences[3] == 0 and sequences[2] > 0:
	isEqual &= 0
print(1 if isEqual else 0)


f1 = int(input())
f2 = int(input())
f3 = int(input())
f4 = int(input())
if f1 == 0 and f3 == 0 and (f4 == 0):
	print(1)
elif f1 == 0:
	print(0)
elif f1 == f4:
	print(1)
else:
	print(0)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	if c > 0:
		if a > 0 and d > 0:
			a = a * 2 - 1
			d = d * 2 - 1
		else:
			print(0)
			return
	if a == d:
		print(1)
	else:
		print(0)
	return
main()


i = input
List = []
for j in range(4):
	List.append(int(i()))
if List[0] == List[3] and List[0] != 0:
	print(1)
elif List[0] == List[3] and List[0] == 0 and (List[2] == 0):
	print(1)
else:
	print(0)


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N1 = int(input())
_ = int(input())
N3 = int(input())
N4 = int(input())
ans = 0
if N1 == N4:
	if N3 > 0:
		if N1 > 0:
			ans = 1
	else:
		ans = 1
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
p = True
if c != 0:
	if a != 0:
		g = 1
	else:
		p = False
if a == d:
	g = 1
else:
	p = False
if p == True:
	print(1)
else:
	print(0)


L = [int(input()) for _ in range(4)]
if L[0] == L[3]:
	if L[0] > 0:
		print(1)
	elif L[2] == 0:
		print(1)
	else:
		print(0)
else:
	print(0)


t1 = '(('
t2 = '()'
t3 = ')('
t4 = '))'
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
ans = 1
if cnt1 != cnt4 or (cnt3 > 0 and cnt1 == 0):
	ans = 0
print(ans)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if (a == 0 or d == 0) and c != 0:
	print(0)
elif 2 * a + c == 2 * d + c:
	print(1)
else:
	print(0)


(cnt1, cnt2, cnt3, cnt4) = (int(input()) for i in range(4))
print(int(bool(cnt1 == cnt4 and (not cnt3 or (cnt1 and cnt4)))))


ll = int(input())
lr = int(input())
rl = int(input())
rr = int(input())
if ll != rr:
	print(0)
elif rl > 0:
	print(1 if ll > 0 else 0)
else:
	print(1)


def rli():
	return list(map(int, input().split()))

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	if a != d or (c != 0 and a == d and (a == 0)):
		print(0)
	else:
		print(1)
main()


a = int(input())
b = int(input())
c = int(input())
d = int(input())
f = True
k = 2 * a
if c:
	if k < 1:
		print(0)
	elif k == 2 * d:
		print(1)
	else:
		print(0)
elif k == 2 * d:
	print(1)
else:
	print(0)


a = int(input())
input()
c = int(input())
b = int(input())
if c:
	print(int(a == b and a > 0))
else:
	print(int(a == b))


s1 = int(input())
s2 = int(input())
s3 = int(input())
s4 = int(input())
ans = True
if s1 != s4:
	ans = False
if s3 != 0:
	if s1 == 0:
		ans = False
	if s4 == 0:
		ans = False
if ans:
	print(1)
else:
	print(0)


import sys
counts = [(2, 0), (1, 1), (1, 1), (0, 2)]
cnts = list(map(int, sys.stdin.read().split()))
if cnts[0] == cnts[3] and (cnts[2] == 0 or cnts[0] > 0):
	print(1)
else:
	print(0)


from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
mod = 10 ** 9 + 7
ans = 0
open = 0
close = 0
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if c != 0:
	a -= 1
	d -= 1
if a < 0 or d < 0:
	print(0)
	exit()
elif a == d:
	print(1)
else:
	print(0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 == 0 and cnt4 == 0 and (cnt3 != 0):
	print(0)
	exit()
x = cnt1 * 2 - cnt3
y = cnt4 * 2 - cnt3
if x == y:
	print(1)
else:
	print(0)


cr1 = input()
cr2 = input()
cr3 = input()
cr4 = input()
if cr1 != cr4:
	print(0)
elif int(cr3) > 0 and int(cr1) == 0:
	print(0)
else:
	print(1)


c = [0, int(input()), int(input()), int(input()), int(input())]
flag = 1
if c[1] != c[4]:
	flag = 0
if c[3] > 0 and c[1] == 0:
	flag = 0
print(flag)


a = int(input())
input()
c = int(input())
d = int(input())
if a == 0 and c != 0:
	print(0)
elif d == 0 and c != 0:
	print(0)
elif a == d:
	print(1)
else:
	print(0)


def func(params):
	(a, b, c, d) = params
	if 2 * a != 2 * d:
		print(0)
		return
	if a == 0 and d == 0 and (c != 0):
		print(0)
		return
	print(1)
params = []
for _ in range(4):
	params.append(int(input()))
func(params)


cnt = list()
cnt.append(int(input()))
cnt.append(int(input()))
cnt.append(int(input()))
cnt.append(int(input()))
res = 1
if cnt[0] != cnt[3]:
	res = 0
elif cnt[0] == 0 and cnt[2] != 0:
	res = 0
print(res)


(x, y, z, w) = (int(input()), int(input()), int(input()), int(input()))
if x == w:
	if z > 0:
		if x > 0:
			print(1)
		else:
			print(0)
	else:
		print(1)
else:
	print(0)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
cnt = [0] * 5
for i in range(1, 5):
	cnt[i] = intIn()
op = cnt[1] * 2 + cnt[3]
cl = cnt[4] * 2 + cnt[3]
if op == cl:
	if cnt[1] == 0 and cnt[3] > 0:
		print(0)
	else:
		print(1)
else:
	print(0)


(cnt1, cnt2, cnt3, cnt4) = (int(input()), int(input()), int(input()), int(input()))
print([0, 1][cnt1 == cnt4 > 0 or cnt1 == cnt3 == cnt4 == 0])


a = []
for i in range(4):
	a.append(int(input()))
if a[0] == a[-1] and (a[0] > 0 or a[2] == 0):
	print(1)
else:
	print(0)


cn1 = int(input().strip())
cn2 = int(input().strip())
cn3 = int(input().strip())
cn4 = int(input().strip())
if cn1 == cn4 and cn1 > 0:
	print(1)
elif cn1 == cn4 and cn3 == 0:
	print(1)
else:
	print(0)


cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
possible = 1
if cnt4 != cnt1:
	possible = 0
if cnt3 > 0 and cnt1 == 0:
	possible = 0
print(possible)


cnt = []
cnt.append(int(input()))
cnt.append(int(input()))
cnt.append(int(input()))
cnt.append(int(input()))
if cnt[0] == cnt[3]:
	if cnt[0] == 0 and cnt[2] != 0:
		print(0)
	else:
		print(1)
else:
	print(0)


t1 = int(input())
t2 = int(input())
t3 = int(input())
t4 = int(input())
if t1 == t4 and (not t3 or t1 > 0):
	print(1)
else:
	print(0)


def f(cnt1, cnt2, cnt3, cnt4):
	if cnt1 == cnt4:
		if cnt3 == 0:
			return 1
		elif cnt1 > 0:
			return 1
	return 0
print(f(int(input()), int(input()), int(input()), int(input())))


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 0
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	a = ii()
	b = ii()
	c = ii()
	d = ii()
	f = 1
	if a == d:
		if c > 0:
			if a == 0:
				f = 0
	else:
		f = 0
	print(f)
solve()


import sys, math
sys.setrecursionlimit(10 ** 8)
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 + cnt3 + cnt4 == 0:
	print(1)
elif cnt1 * 2 + cnt3 == cnt3 + cnt4 * 2 and cnt1 != 0 and (cnt4 != 0):
	print(1)
else:
	print(0)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a - d is 0:
	if a is 0 and c is 0:
		print('1')
	elif a is not 0:
		print('1')
	else:
		print('0')
else:
	print('0')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
c1 = int(input())
c2 = int(input())
c3 = int(input())
c4 = int(input())
if c3 > 0:
	c3 = 1
if c1 == c4 and c1 >= c3:
	print('1')
else:
	print('0')


cnt = []
for _ in range(4):
	c = input()
	c = int(c)
	cnt.append(c)
if cnt[0] == cnt[3] and cnt[0] >= cnt[2] / 1000000000:
	print('1')
else:
	print('0')


import re
ar = 'timrbitbukanRbitttdantimRphiadalahtemantimRvpihiRbittttt'
ar = re.split('R(?:bit|phi)', ar)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a != d or (c > 0 and a == 0):
	print(0)
else:
	print(1)


from sys import exit, setrecursionlimit
setrecursionlimit(10 ** 6)
inn = lambda : input().strip()
mapp_m1 = lambda : map(lambda x: int(x) - 1, inn().split(' '))
mapp = lambda : map(int, inn().split(' '))
N = [int(inn()) for _ in range(4)]
if N[0] != N[3]:
	print(0)
	exit()
elif N[2] > 0 and (N[0] == 0 or N[3] == 0):
	print(0)
	exit()
else:
	print(1)


a = int(input())
int(input())
c = int(input())
d = int(input())
print(1 - int(a != d or (a == 0 and (not a == c == d))))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
cnt1 = INT()
cnt2 = INT()
cnt3 = INT()
cnt4 = INT()
if cnt1 != cnt4:
	print(0)
elif cnt3 > 0 and cnt1 == cnt4 == 0:
	print(0)
else:
	print(1)


import sys, queue
sys.setrecursionlimit(1000000)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a == d:
	if a == 0:
		print(int(c == 0))
	else:
		print(1)
else:
	print(0)


c = []
for i in range(4):
	c.append(int(input()))
con1 = True
if c[0] != c[3]:
	con1 = False
con2 = True
if c[2] > 0 and (c[0] == 0 or c[3] == 0):
	con2 = False
if con1 and con2:
	print(1)
else:
	print(0)