beecrowd | 1867

The Greater One-digit Number

By Ricardo Martins, IFSULDEMINAS Brazil

Timelimit: 1

The inhabitants of the planet Uno have a terrible numbers detection problem with more than one digit, so that , for everything that will make transform any integer value in a one-digit number by performing successive sums of the number until it is reduced a digit. For example , the number 999999999991 , the planet Uno , summing up all the numbers, resulting in 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 1 = 100. Since the number 100 has more than one digit, the process repeats , resulting in 0 + 0 + 1 = 1 One of the great difficulties that people have is to compare two numbers and see which one is greater , under the rules of the planet.

Write a program that , given two integers , identify which one is the biggest one-digit number .

Input

There will be several test cases . Each test case begins with two integers N and M ( 0 ≤ N ≤ 10100, 0 ≤ M ≤ 10100 ), indicating the two numbers to be compared. The last test case is given when N = M = 0 , and this case will not be processed.

Output

For each test case , print a line containing an integer, indicating 1 if the first number is the largest of a number , 2 if the second number is the largest of a number or 0 if both numbers have the same value of a number.

 Input Sample Output Sample 111 2 22 55 123 222 12 4 0 0 1 1 0 2