Олимпиадный тренинг

Задача 39360. Converting a number to decimal number system


Write a program that converts the number N from base r to decimal.

Input
The program receives two natural numbers as input: and r (2 <= r <= 9). It is guaranteed that the number N is the correct representation of the number in the number system with the base r (that is, it contains the numbers from 0 to r- 1).

Imprint
Display the number in decimal notation.
 
Examples
# Input Output
1 100 2 4

Запрещенные операторы:hex;bin;oct;str(;[;list