#P1132A. Regular Bracket Sequence

Regular Bracket Sequence

Description

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 22. So, overall you have cnt1cnt_1 strings "((", cnt2cnt_2 strings "()", cnt3cnt_3 strings ")(" and cnt4cnt_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(cnt1+cnt2+cnt3+cnt4)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.

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

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

Input

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

Output

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

Sample Input 1

3
1
4
3

Sample Output 1

1

Sample Input 2

0
0
0
0

Sample Output 2

1

Sample Input 3

1
2
3
4

Sample Output 3

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.