Problems

# Explicit Formula

Consider 10 Boolean variables x1,x2,x3,x4,x5,x6,x7,x8,x9, and x10. Consider all pairs and triplets of distinct variables among these ten. (There are 45 pairs and 120 triplets.) Count the number of pairs and triplets that contain at least one variable equal to 1. Set f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 1 if this number is odd and f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 0 if this number is even.

Here's an explicit formula that represents the function f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) correctly:

f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = (x1 V x2) (x1 V x3) (x1 V x4) (x1 V x5) (x1 V x6) (x1 V x7) (x1 V x8) (x1 V x9) (x1 V x10) (x2 V x3) (x2 V x4) (x2 V x5) (x2 V x6) (x2 V x7) (x2 V x8) (x2 V x9) (x2 V x10) (x3 V x4) (x3 V x5) (x3 V x6) (x3 V x7) (x3 V x8) (x3 V x9) (x3 V x10) (x4 V x5) (x4 V x6) (x4 V x7) (x4 V x8) (x4 V x9) (x4 V x10) (x5 V x6) (x5 V x7) (x5 V x8) (x5 V x9) (x5 V x10) (x6 V x7) (x6 V x8) (x6 V x9) (x6 V x10) (x7 V x8) (x7 V x9) (x7 V x10) (x8 V x9) (x8 V x10) (x9 V x10) (x1 V x2 V x3) (x1 V x2 V x4) (x1 V x2 V x5) (x1 V x2 V x6) (x1 V x2 V x7) (x1 V x2 V x8) (x1 V x2 V x9) (x1 V x2 V x10) (x1 V x3 V x4) (x1 V x3 V x5) (x1 V x3 V x6) (x1 V x3 V x7) (x1 V x3 V x8) (x1 V x3 V x9) (x1 V x3 V x10) (x1 V x4 V x5) (x1 V x4 V x6) (x1 V x4 V x7) (x1 V x4 V x8) (x1 V x4 V x9) (x1 V x4 V x10) (x1 V x5 V x6) (x1 V x5 V x7) (x1 V x5 V x8) (x1 V x5 V x9) (x1 V x5 V x10) (x1 V x6 V x7) (x1 V x6 V x8) (x1 V x6 V x9) (x1 V x6 V x10) (x1 V x7 V x8) (x1 V x7 V x9) (x1 V x7 V x10) (x1 V x8 V x9) (x1 V x8 V x10) (x1 V x9 V x10) (x2 V x3 V x4) (x2 V x3 V x5) (x2 V x3 V x6) (x2 V x3 V x7) (x2 V x3 V x8) (x2 V x3 V x9) (x2 V x3 V x10) (x2 V x4 V x5) (x2 V x4 V x6) (x2 V x4 V x7) (x2 V x4 V x8) (x2 V x4 V x9) (x2 V x4 V x10) (x2 V x5 V x6) (x2 V x5 V x7) (x2 V x5 V x8) (x2 V x5 V x9) (x2 V x5 V x10) (x2 V x6 V x7) (x2 V x6 V x8) (x2 V x6 V x9) (x2 V x6 V x10) (x2 V x7 V x8) (x2 V x7 V x9) (x2 V x7 V x10) (x2 V x8 V x9) (x2 V x8 V x10) (x2 V x9 V x10) (x3 V x4 V x5) (x3 V x4 V x6) (x3 V x4 V x7) (x3 V x4 V x8) (x3 V x4 V x9) (x3 V x4 V x10) (x3 V x5 V x6) (x3 V x5 V x7) (x3 V x5 V x8) (x3 V x5 V x9) (x3 V x5 V x10) (x3 V x6 V x7) (x3 V x6 V x8) (x3 V x6 V x9) (x3 V x6 V x10) (x3 V x7 V x8) (x3 V x7 V x9) (x3 V x7 V x10) (x3 V x8 V x9) (x3 V x8 V x10) (x3 V x9 V x10) (x4 V x5 V x6) (x4 V x5 V x7) (x4 V x5 V x8) (x4 V x5 V x9) (x4 V x5 V x10) (x4 V x6 V x7) (x4 V x6 V x8) (x4 V x6 V x9) (x4 V x6 V x10) (x4 V x7 V x8) (x4 V x7 V x9) (x4 V x7 V x10) (x4 V x8 V x9) (x4 V x8 V x10) (x4 V x9 V x10) (x5 V x6 V x7) (x5 V x6 V x8) (x5 V x6 V x9) (x5 V x6 V x10) (x5 V x7 V x8) (x5 V x7 V x9) (x5 V x7 V x10) (x5 V x8 V x9) (x5 V x8 V x10) (x5 V x9 V x10) (x6 V x7 V x8) (x6 V x7 V x9) (x6 V x7 V x10) (x6 V x8 V x9) (x6 V x8 V x10) (x6 V x9 V x10) (x7 V x8 V x9) (x7 V x8 V x10) (x7 V x9 V x10) (x8 V x9 V x10)

In this formula V stands for logical or, and stands for exclusive or (xor). Remember that in C++ and Java these two binary operators are denoted as "||" and "^".

Given the values of x1,x2,x3,x4,x5,x6,x7,x8,x9,x10, calculate the value of f(x1, x2, ..., x10).

Input

The input file contains 10 numbers x1,x2,x3,x4,x5,x6,x7,x8,x9, and x10. Each of them is either 0 or 1.

Output

Output a single value - f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10).

Time limit 1 second
Memory limit 256 MiB
Input example
```1 0 0 1 0 0 1 0 0 1
```
Output example
```0
```
Author Mikhail Dvorkin, Georgiy Korneev