10710 - H-Simple Math Challenge   

Description

Captcha authentication methods play an important role these days. It usually require users to recognize the alphabets and the number digits. But sometimes, it require users to solve an integral problem and some word riddles! One day, Kirito noticed there is a new type of Captcha challenge! It shows a strange math equation like this:
(1/n)sin x =?
    After ten minutes work, Kirito realized that the answer was 6, because the value n cancelled out!
    In order to solve these type of equation quickly, you are going to help Kirito to write a program. Kirito knows that the answer is guaranteed to be an integer in the range [0, 9], and he had already parsed the strings for you in the certain format. (Please refer to the input format.)

Input

The first line of the input data contains an integer T (1 ≤ T ≤ 100) specifying
the number of test cases.
    For each test case, there are two strings representing the numerator and
the denominator in the formula separated by a whitespace, a slash then
another whitespace. There will be only one possible unique answer, and all
strings are composed of lower case letters only. The length of each string will
be at most 100 and at least 1.

Output

For each test case, please output the answer. You may treat each letter a variable, so they can be swapped properly. For example, we know that ab = ba.

Sample Input  Download

Sample Output  Download

Tags




Discuss