Four Arithmetic Operations
Problem statement
There is a rational number sequence X0,X1,X2,...,XN. Each term is defined as follows.
- X0=0
- Xi=Xi−1 opi Yi (1 leqi leqN). However, opi is +, −, ×, ÷ Either.
Find XN.
Constraint
- 1 leqN leq105
- 1 leqoi leq4
- −106 leqYi leq106
- If oi=4, then Yi neq0
- XN is an integer greater than or equal to −231 and less than 231.
input
Input follows the following format. All given numbers are integers.
N
o1 Y1
o2 Y2
...
oN YN
When oi=1, opi is +, when oi=2, opi is −, when oi=3, opi is ×, and when oi=4, opi is ÷.
output
Print the value of XN on one line.
Example
Input
4
1 1
4 2
2 4
3 4
Output
-14
input
Input follows the following format. All given numbers are integers.
N
o1 Y1
o2 Y2
...
oN YN
When oi=1, opi is +, when oi=2, opi is −, when oi=3, opi is ×, and when oi=4, opi is ÷.
output
Print the value of XN on one line.
Example
Input
4
1 1
4 2
2 4
3 4
Output
-14
样例
4
1 1
4 2
2 4
3 4
-14