S2P1 - Calculator

no tags 

Mohamed is always using his laptop calculator. But his laptop calculator crashed and not working now. So he needs your help to develop a new calculator that has the following features:

  • Add: add 2 numbers.
  • Multiply: multiply 2 numbers.
  • Subtract: subtract 2 numbers.
  • Division: divide 2 numbers, but print "Error" if the second number is zero.
  • AND: and 2 numbers (guarantee that 2 numbers will be 1 or zero.)
  • XOR: XOR 2 numbers (guarantee that 2 numbers will be 1 or zero.)
  • OR: OR 2 numbers (guarantee that 2 numbers will be 1 or zero.)
  • Mod: reminder of n1/n2

Input

input will contain several lines.

First line contain N where N is number of instructions, 1 <= N <= 100.

next N line contain each instruction that will be in form of:

n1 (+, -, *, /, |, &, ^, %) n2 where -1000 <= n1, n2 <= 1000 and operators (+, -, *, /, |, &, ^, %) for (add, subtract, multiply, divide, OR, AND, XOR, mod.)

Output

print N lines contain result of each instruction. Print endl after each line you print.

Example

Input:
3
1 + 2
2 / 0
0 & 1

Output:
3
Error
0


Added by:mohamed gamal
Date:2012-01-27
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C++ 4.3.2 CPP