Module: Number systems


Problem

6 /9


Prize

Problem

Despite the crisis, Soft-Soft is doing well. The director of the company decided to pay bonuses to employees. The list of the lucky ones was released the next day. In order not to disclose the amount of payments, strange numbers and even letters flaunted in front of the names on the list. Employees quickly guessed that the amount of bonuses was written in different number systems. But where and what number system is used, only secretary Tanechka figured out, who remembered that the director asked her to bring information about the age of employees. She realized that the headmaster was dropping the tens from the number indicating age, and adding the number 2 to the remaining ones. The resulting value served as the basis for presenting the accrued premium.
 
Help the curious Tanechka find out the amount of bonuses in decimal notation. It is known that the amount of premiums does not exceed 100,000 rubles in decimal notation.
 
Input
On the first line  two integers N and K – age and bonus amount separated by a space. The age does not exceed 100, the amount of the award is indicated in some number system (the number does not contain insignificant zeros, uses Arabic numerals and capital English letters).
 
Output
Print a single number – the amount of the premium in decimal notation.
 

 

Examples
# Input Output
1 28 2800 2800
2 30 101 5