#P784E. Twisted Circuit

Twisted Circuit

Description

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

Output a single digit, 0 or 1.

Input

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

Output

Output a single digit, 0 or 1.

Samples

0
1
1
0

0