#b448. Weird Algorithm (test problem)

Weird Algorithm (test problem)

Description

Author: miyun

Consider an algorithm that takes as input a positive integer nnnnnn. If nnnnnn is even, the algorithm divides it by two, and if nnnnnn is odd, the algorithm multiplies it by three and adds one. The algorithm repeats this, until nnnnnn is one. For example, the sequence for n=3n=3n=3n=3n=3n=3 is as follows:

$$3→10→5→16→8→4→2→1 3 → 10 → 5 → 16 → 8 → 4 → 2 → 13→10→5→16→8→4→2→1$$

Your task is to simulate the execution of the algorithm for a given value of nnnnnn.

Constraints

  • 1n1061n1061n1061≤n≤1061 ≤ n ≤ 10^61≤n≤106

 


# Below are test area.

test bold

test italic</p>

test underline strikethrough

super

sub

code

  • list1

  • list2

Input Format

The only input line contains an integer nnnnnn.

Output Format

Print a line that contains all values of nnnnnn during the algorithm.

3
3 10 5 16 8 4 2 1