Explicit Formula
Consider 10 Boolean variables x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, and x_10. 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(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10) = 1 if this number is odd and f(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10) = 0 if this number is even.
Here's an explicit formula that represents the function f(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10) correctly:
f(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10) = (x_1 V x_2) (x_1 V x_3) (x_1 V x_4) (x_1 V x_5) (x_1 V x_6) (x_1 V x_7) (x_1 V x_8) (x_1 V x_9) (x_1 V x_10) (x_2 V x_3) (x_2 V x_4) (x_2 V x_5) (x_2 V x_6) (x_2 V x_7) (x_2 V x_8) (x_2 V x_9) (x_2 V x_10) (x_3 V x_4) (x_3 V x_5) (x_3 V x_6) (x_3 V x_7) (x_3 V x_8) (x_3 V x_9) (x_3 V x_10) (x_4 V x_5) (x_4 V x_6) (x_4 V x_7) (x_4 V x_8) (x_4 V x_9) (x_4 V x_10) (x_5 V x_6) (x_5 V x_7) (x_5 V x_8) (x_5 V x_9) (x_5 V x_10) (x_6 V x_7) (x_6 V x_8) (x_6 V x_9) (x_6 V x_10) (x_7 V x_8) (x_7 V x_9) (x_7 V x_10) (x_8 V x_9) (x_8 V x_10) (x_9 V x_10) (x_1 V x_2 V x_3) (x_1 V x_2 V x_4) (x_1 V x_2 V x_5) (x_1 V x_2 V x_6) (x_1 V x_2 V x_7) (x_1 V x_2 V x_8) (x_1 V x_2 V x_9) (x_1 V x_2 V x_10) (x_1 V x_3 V x_4) (x_1 V x_3 V x_5) (x_1 V x_3 V x_6) (x_1 V x_3 V x_7) (x_1 V x_3 V x_8) (x_1 V x_3 V x_9) (x_1 V x_3 V x_10) (x_1 V x_4 V x_5) (x_1 V x_4 V x_6) (x_1 V x_4 V x_7) (x_1 V x_4 V x_8) (x_1 V x_4 V x_9) (x_1 V x_4 V x_10) (x_1 V x_5 V x_6) (x_1 V x_5 V x_7) (x_1 V x_5 V x_8) (x_1 V x_5 V x_9) (x_1 V x_5 V x_10) (x_1 V x_6 V x_7) (x_1 V x_6 V x_8) (x_1 V x_6 V x_9) (x_1 V x_6 V x_10) (x_1 V x_7 V x_8) (x_1 V x_7 V x_9) (x_1 V x_7 V x_10) (x_1 V x_8 V x_9) (x_1 V x_8 V x_10) (x_1 V x_9 V x_10) (x_2 V x_3 V x_4) (x_2 V x_3 V x_5) (x_2 V x_3 V x_6) (x_2 V x_3 V x_7) (x_2 V x_3 V x_8) (x_2 V x_3 V x_9) (x_2 V x_3 V x_10) (x_2 V x_4 V x_5) (x_2 V x_4 V x_6) (x_2 V x_4 V x_7) (x_2 V x_4 V x_8) (x_2 V x_4 V x_9) (x_2 V x_4 V x_10) (x_2 V x_5 V x_6) (x_2 V x_5 V x_7) (x_2 V x_5 V x_8) (x_2 V x_5 V x_9) (x_2 V x_5 V x_10) (x_2 V x_6 V x_7) (x_2 V x_6 V x_8) (x_2 V x_6 V x_9) (x_2 V x_6 V x_10) (x_2 V x_7 V x_8) (x_2 V x_7 V x_9) (x_2 V x_7 V x_10) (x_2 V x_8 V x_9) (x_2 V x_8 V x_10) (x_2 V x_9 V x_10) (x_3 V x_4 V x_5) (x_3 V x_4 V x_6) (x_3 V x_4 V x_7) (x_3 V x_4 V x_8) (x_3 V x_4 V x_9) (x_3 V x_4 V x_10) (x_3 V x_5 V x_6) (x_3 V x_5 V x_7) (x_3 V x_5 V x_8) (x_3 V x_5 V x_9) (x_3 V x_5 V x_10) (x_3 V x_6 V x_7) (x_3 V x_6 V x_8) (x_3 V x_6 V x_9) (x_3 V x_6 V x_10) (x_3 V x_7 V x_8) (x_3 V x_7 V x_9) (x_3 V x_7 V x_10) (x_3 V x_8 V x_9) (x_3 V x_8 V x_10) (x_3 V x_9 V x_10) (x_4 V x_5 V x_6) (x_4 V x_5 V x_7) (x_{4 }V x_5 V x_8) (x_4 V x_5 V x_9) (x_4 V x_5 V x_10) (x_4 V x_6 V x_7) (x_4 V x_6 V x_8) (x_4 V x_6 V x_9) (x_4 V x_6 V x_10) (x_4 V x_7 V x_8) (x_4 V x_7 V x_9) (x_4 V x_7 V x_10) (x_4 V x_8 V x_9) (x_4 V x_8 V x_10) (x_4 V x_9 V x_10) (x_5 V x_6 V x_7) (x_5 V x_6 V x_8) (x_5 V x_6 V x_9) (x_5 V x_6 V x_10) (x_5 V x_7 V x_8) (x_5 V x_7 V x_9) (x_5 V x_7 V x_10) (x_5 V x_8 V x_9) (x_5 V x_8 V x_10) (x_5 V x_9 V x_10) (x_6 V x_7 V x_8) (x_6 V x_7 V x_9) (x_6 V x_7 V x_10) (x_6 V x_8 V x_9) (x_6 V x_8 V x_10) (x_6 V x_9 V x_10) (x_7 V x_8 V x_9) (x_7 V x_8 V x_10) (x_7 V x_9 V x_10) (x_8 V x_9 V x_10)
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 x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10, calculate the value of f(x_1, x_2, ..., x_10).
Input
The input file contains 10 numbers x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, and x_10. Each of them is either 0 or 1.
Output
Output a single value - f(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10).