e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

PP2. Week 5: April 5 - 11

From base k to base 10

The number n is given in the base k system. Convert number n into decimal system.

Input

Two non-negative integers k (2k10) and n.

Output

Print one number n in the decimal system. It is guaranteed that n is no more than 109 in decimal notation.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2
1
Output example #1
1
Input example #2
6
53414
Output example #2
7282