#D227. Expression
Expression
Expression
problem
Given the formula of length . The formula is in the format shown in BNF below.
:: = |
:: = ‘^’ | ‘&’ | ‘|’
represents an integer greater than or equal to and less than or equal to .
The operators ‘^’ ‘&’ ‘|’ represent exclusive OR, AND, and OR, respectively. The precedence of operators is as follows.
High ‘^’> ‘&’> ‘|’ Low
intervals are given. Output the calculation result of .
It is guaranteed that the formulas are in the format shown by the above BNF. Also, the formula does not contain zero-padded values.
output
Output the calculation result of . Also, output a line break at the end.
Example
Input
7 9^2&1|2 4 0 6 0 2 2 6 4 4
Output
3 11 2 1
inputFormat
outputFormat
Output the calculation result of .
It is guaranteed that the formulas are in the format shown by the above BNF. Also, the formula does not contain zero-padded values.
output
Output the calculation result of . Also, output a line break at the end.
Example
Input
7 9^2&1|2 4 0 6 0 2 2 6 4 4
Output
3 11 2 1
样例
7
9^2&1|2
4
0 6
0 2
2 6
4 4
3
11
2
1
</p>