Professor Oak is desperate, searching for easy problems. Unfortunately, he is asking for the help of some students whose understanding of the word “easy” is questionable. It may be the case with this problem...
You are given some basic operations, and you just have to compute the result. To make the problem “less trivial”, you must compute the result for several initial values.
Input consists of several cases. Each case starts with the number of
operations
and the number of initial values
.
Follow
pairs of the kind +
,
*
,
/
,
,
and
,
where the last three are the usual or,
and and xor
bitwise operations. Follow the
initial numbers, all different, to which the operations must be
applied.
Assume that
and
are between 1 and
,
and that all the given numbers are between 0 and
.
For every case, there are at most 100 operations that are not
bitwise (that is, that are +, *, or
/). With the given cases, all the intermediate and final
results will be between 0 and
.
You will never be asked to divide by 0.
For every case, and for every initial number, print the result of applying all the operations in order. Print a line with 10 dashes at the end of every case.
For instance, consider the first initial number (1) of the first case. The result (10) is produced by these steps: , $11 \symbol{38} 3 = 3$, $3 \symbol{94} 2 = 1$, , $23 \symbol{124} 12 = 31$, and .
Input
6 5 + 10 & 3 ^ 2 * 23 | 12 / 3 1 2 3 4 5 1 1 & 1000000000000000 500000000000000
Output
10 15 25 4 10 ---------- 426876803874816 ----------