407174: GYM102697 145 Star Wars
Description
You've traveled across a galaxy far, far away, and you land on a planet with two different alien species. Each alien species counts numbers in a different base. Aliens of the first species count numbers using base $$$a$$$, and aliens of the second species count numbers using base $$$b$$$. The base used by most humans is decimal, base 10.
The two alien species are about to start a war, because they cannot properly communicate in numbers. Your task is to convert a number from the first alien species, in base $$$a$$$, into base $$$b$$$, in order to avert the impending alien war.
InputThe first line of input contains two integers $$$a$$$ and $$$b$$$ less than or equal to 10: the number base used by the first alien species, and the number base used by the second alien species, respectively.
The second line of input contains a single integer $$$n$$$ in base $$$a$$$.
OutputOutput $$$m$$$: the given integer, converted from base $$$a$$$ to base $$$b$$$.
ExamplesInput7 9 63642Output
23550Input
10 3 8790971Output
121112121221112Input
5 6 3124Output
1530