Related odd and even positions X98097


Statement
 

pdf   zip

html

Given a non-zero natural n, compute the sum of the digits in odd positions and the sum of the digits in even positions. If one of the two sums is a multiple of the other, your program has to print the relating factor.

Input

The input is a non-zero natural number 0 < n < 231.

Output

The output consists of two lines. The first line shows the sum of digits in odd positions and the sum of digits in even positions. The second line indicates the relationship among the two quantities, including the exact relation when one is a multiple of the other.


Follow the format given in the examples.

Observation

Remember that the last digit of a natural number n occupies an odd position. For example, for n=212121, the odd positions are those occupied by 1’s and the even positions are those occupied by 2’s.


Public test cases
  • Input

    1
    

    Output

    1 0
    0 = 0 * 1
    
  • Input

    10
    

    Output

    0 1
    0 = 0 * 1
    
  • Input

    212121
    
    

    Output

    3 6
    6 = 2 * 3
    
  • Input

    121212
    

    Output

    6 3
    6 = 2 * 3
    
  • Input

    121213
    

    Output

    7 3
    nothing
    
  • Information
    Author
    Maria J. Blesa
    Language
    English
    Translator
    Maria J. Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    Unknown.
    User solutions
    C++