Mars Math

No attempts yetTime limit1sMemory limit128 MB

Problem

After visiting the Moon over winter break, Sanggeun plans to visit Mars over summer break. On Mars, three operators @, %, and # are used, which differ slightly from those on Earth.

  • @: multiplies the preceding number by $3$.
  • %: adds $5$ to the preceding number.
  • #: subtracts $7$ from the preceding number.

A Mars math expression begins with a single number, followed by a sequence of operators. The operators are applied from left to right.

Input

The first line contains the number of test cases $T$. Each of the next $T$ lines contains one Mars math expression. The leading number of each expression is an integer or a number given to one decimal place, between $0$ and $100$ inclusive. At most $3$ operators are given, and the number and the operators are separated by spaces.

Output

For each test case, print the result of evaluating the Mars math expression to two decimal places.