S5P1 - Calculator for Arrays

no tags 

 

As you are clever programming. it's required from you to develop an advanced calculator that perform +,-,*,/,%,^ between 2 arrays with the same size
for example:
3 4 5 6
+
5 6 3 1
so the result will be 8 10 8 7.
in the division operation print "Error" when you divide by 0.

 

As you are clever programming. it's required from you to develop an advanced calculator that perform +,-,*,/,%,^ between 2 arrays with the same size

for example:

3 4 5 6

+

5 6 3 1

so the result will be 8 10 8 7.

in the division operation print "Error" when you divide by 0.

 

 

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
n a0,..an-1 op b0,..,bn-1
where n is size of both arrays, (a0,..,an-1) first array elements  , op is operation (+,-,*,%,/,^) (add,subtract,multiply,mode ,divide,power),(b0,..,bn-1) second array elements.
All numbers will be integers numbers between [1,1000]

 

Output

N lines each contain result of performing each instructions

print endl after each instruction output

Example

Input:
2
2 3 4 ^ 2 2
3 1 1 1 + 3 4 5 Output: 9 16
4 5  6


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