beecrowd | 1192
# Paula's Mathematic Game

**Timelimit: 2**

By Neilor Tonin, URI Brazil

Paula loves math. Her main hobby is to invent games or activities to play with her friends. Obviously, not all of them are so passionated about mathematics and have a lot of difficulty to solve the games offered by her. Now Paula has invented a small hobby that involves three characters: a numerical digit, one letter and one numeric digit.

If the letter is uppercase, you need to subtract the first digit of the second one. If the letter is lowercase, both digts must be added. If the DIGITS are the same, the product between these two digits must be presented. She asked his friend Marcelo, who is good at programming, to create a program that prints the solution for each sequence created by Paula.

The input contains many test cases. The first line of each input contains a single integer N, indicating the number of following test cases. Each test case is a sequence of three chars created by Paula. This sequence contains in the first position a character between '0' and '9', a uppercase or lowercase character and another character between '0' and '9'.

For each test case, one line must be printed with an integer, representing the solution for each sequence created by Paula

Input Sample | Output Sample |

5 |
1 |