#C5555. Four-Input Logical Gate Operation

    ID: 49217 Type: Default 1000ms 256MiB

Four-Input Logical Gate Operation

Four-Input Logical Gate Operation

You are given four binary inputs A, B, C, and D (each is either 0 or 1). Your task is to compute the result of the following logical expression:

\( (A \land B) \lor \Bigl((C \oplus D) \land (\lnot A \lor B)\Bigr) \)

The operations are defined as follows:

  • \(\land\): Logical AND
  • \(\lor\): Logical OR
  • \(\oplus\): Logical XOR (exclusive OR)
  • \(\lnot\): Logical NOT

Make sure to follow the operator precedence as indicated by the parenthesis in the expression. Read the four inputs from standard input and output the computed result to the standard output.

inputFormat

The input consists of a single line containing four space-separated integers: A, B, C, and D. Each integer is either 0 or 1.

outputFormat

Output a single integer (0 or 1) which is the result of applying the given logical operation on the input values.

## sample
0 1 1 0
1

</p>