Sum of digits (2) X01646


Statement
 

pdf   zip

html

Write a program that reads a basis for numeration and several numbers and prints the sum in base 10 of the digits in base b of each one.

Input

Input consists of the value of b≥ 2 followed by a sequence of natural numbers.

Output

For every number, print the sum (in base 10) of its digits in base b following the format of the examples.

Public test cases
  • Input

    10
    29
    7
    0
    1020
    

    Output

    29: 11
    7: 7
    0: 0
    1020: 3
    
  • Input

    4
    29
    7
    0
    1020
    

    Output

    29: 5
    7: 4
    0: 0
    1020: 12
    
  • Information
    Author
    Maria Serna
    Language
    English
    Translator
    Maria Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    Unknown. This problem is being checked.
    User solutions
    C C++ Python