Statement
Statement language
You are given an array of length , consisting only of , , and .
Repeat the following operation until the length of the array becomes .
Suppose the current length is . Construct a new array of length by
and replace with .
Find the single value that remains at the end.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, print the final remaining value on one line.
Constraints
- .
- .
- ().
- The sum of over all test cases does not exceed .
Subtasks
Samples
Input
1
4
0 2 1 0
Output
1
The array changes as follows.
Therefore, the final remaining value is .