Code with cipher 3 reversed X19883


Statement
 

pdf   zip

The code with cipher 3 reversed of a non-negative integer is to code the number in base 3 and revert the coding. In order to make it even more cryptic, you will change the digits of the resulting number according to the following relation: 0 \rightarrow ’-’, 1 \rightarrow ’+’, 2 \rightarrow ’*’.

The code for a negative integer n<0n<0 starts with a ’:’ which is followed by the coding with cipher 3 reversed of n-n.

Examples

  • 2077 is represented in base 3 as 2211221 (reverted as 1221122) and coded as +**++**

  • -2077 is coded as :+**++**

  • 0 is represented in base 3 as 0 (reverted as 0) and coded as -

  • 31 is represented in base 3 as 1011 (reverted as 1101) and coded as ++-+

  • 257 is represented in base 3 as 100112 (reverted as 211001) and coded as ++–+

  • 5766 is represented in base 3 as 21220120 (reverted as 02102212) and coded as -*+-**+*

Write a program to code integers in cipher 3 reverse coding according to the described algorithm.

Input

The input is a sequence of integer numbers.

Output

The output is the code in cipher 3 reversed of each number.

Follow the format of the examples.

Public test cases
  • Input

    2077 
    -2077
    0
    31 
    257 
    5766
    

    Output

    +**++**
    :+**++**
    -
    ++-+
    *++--+
    -*+-**+*
    
  • Information
    Author
    Maria J. Blesa i Maria Serna
    Language
    English
    Translator
    Maria Serna
    Original language
    Catalan
    Other languages
    Catalan Spanish
    Official solutions
    Unknown.
    User solutions
    C++ Java Python