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: interview

Starter code:

Solutions:
cnt1 = int(input())
cnt2 = int(input())
cnt3 = int(input())
cnt4 = int(input())
if cnt1 != cnt4:
	print(0)
	return

if (cnt3 != 0 and cnt1 == 0):
	print(0)
	return

print(1)

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)


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


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

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


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)


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

res = 1
if c1 != c4:
    res = 0
elif c3 > 0 and c1 == 0:
    res = 0

print(res)

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


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)
    return

if c3 != 0 and c1 == 0:
    print(0)
    return

print(1)


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()


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)

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)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
fl, cnt = 0, 0
if a == d and (a != 0 or c == 0):
    print(1)
else:
    print(0)


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

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)


#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)

isdebug = False
try :
    #raise ModuleNotFoundError
    import pylint
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        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())     #idle 中不会执行 atexit

if isdebug and len(sys.argv) == 1:
    red_inout()

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

def solve(): 
    pass
    
T_ = 1    
#T_, = getIntList()

for iii_ in range(T_):
    #solve()
    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)
    








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


def A():
    cnt1 = int(input())
    cnt2 = int(input())
    cnt3 = int(input())
    cnt4 = int(input())

    if(cnt4!=cnt1):
        print(0)
        return
    if(cnt3>0 and cnt1==cnt4==0):
        print(0)
        return
    print(1)
A()


from collections import defaultdict as dd
import math
def nn():
	return int(input())

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

def mi():
	return list(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)


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

if a==0 and d==0:
    if c==0:
        print(1)
    else:
        print(0)
else:
    if a==d:
        print(1)
    else:
        print(0)

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


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)


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


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):
	if(a!=d):
		print(0)
	else:
		print(1)
else:
	if(a==0 or d==0):
		print(0)
	else:
		if(a!=d):
			print(0)
		else:
			print(1)


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))


def __starting_point():
    main()

__starting_point()