Magic Trick

Count how many starting values from 1 to 100 turn negative or fractional when the given operations are applied in order.

Easy2SimulationBrute forceNo attempts yetTime limit2sMemory limit256 MB

Problem

Your friend shows you a calculation and calls it an amazing math trick. You ask how it works, and your friend explains it.

First you pick any integer kk between 11 and 100100. Then your friend reads out nn operations in order. One operation is one of ADD, SUBTRACT, MULTIPLY, or DIVIDE, together with an integer operand xx.

You apply the operations in the given order. You do not like dealing with fractions or negative numbers, so if the value ever becomes a fraction or a negative number along the way, you tell your friend that he messed up. In other words, if the value right after some operation is not an integer or is less than 00, you stop there and say he messed up. A value of exactly 00 is fine.

You already know the nn operations your friend will read out. How many of the integers from 11 to 100100, taken as the starting value, make you tell your friend that he messed up?

Input

The first line contains the integer nn (1n101 \le n \le 10).

Each of the next nn lines contains one operation and one operand, separated by a space. The operation is one of ADD, SUBTRACT, MULTIPLY, or DIVIDE, and the operand is a positive integer not exceeding 55.

Output

Print on a single line how many of the integers from 11 to 100100 make you tell your friend that he messed up.