ENIGMA-0x03 (2025) - J4 / S0 Obsessed with the number 3

View as PDF

Submit solution

Points: 100 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
Blockly, C, C++, Java, Pascal, Python

Obsessed with the number 3

Totos loves the number 3. He thinks about it all day, in everything he does!

He always chooses a fork with 3 prongs, wants his cookies in groups of 3, climbs stairs 3 steps at a time, and counts his steps until he reaches a multiple of 3.

But... not everything in life is a multiple of 3. Some numbers he really does't like at all!

Then he had an idea: Anything that is not a multiple of 3, he will multiply by 3!

Can you create a program that will help Totos with his idea?

The program will read consecutive integers from the input. The input stops when the number 0 is given. For each number read (except 0), if it is a multiple of 3, the program outputs the number itself. Otherwise, it outputs three times the number.

Example

Input

3
5
0

Output

3
15

Comments

There are no comments at the moment.