#D10548. Twisted Circuit

    ID: 8764 Type: Default 2000ms 64MiB

Twisted Circuit

Twisted Circuit

Input

The input consists of four lines, each line containing a single digit 0 or 1.

Output

Output a single digit, 0 or 1.

Example

Input

0 1 1 0

Output

0

inputFormat

Input

The input consists of four lines, each line containing a single digit 0 or 1.

outputFormat

Output

Output a single digit, 0 or 1.

Example

Input

0 1 1 0

Output

0

样例

0
1
1
0
0

</p>