9364 - Find max in 3n+1 series   

Description

  Consider the following algorithm:

  1. Input n
  2. Set M to be n
  3. If n is equal to 1, then STOP
    Else Set 
  4. M = Max(M , n)
  5. GOTO Step 3.

Given one integer n. Please output the M after processing the algorithm.

Input

The input includes multiple test cases. In each test case, the first line contains one integer n. Guarantee the algorithm won’t go into infinite steps when n is between 1 and 106.

1<= n <= 106

 

For Case1 and Case2, the value during operation will not exceed 10^7.

For Case3 and Case4, the value during operation will not exceed 10^11.


For Case1, the number of test case <= 5000

For Case2, the number of test case <= 50000

For Case3, the number of test case <= 500000

For Case4, the number of testcase <= 1600000

Output

 For each testcase, output one line contains one integer M.

Sample Input  Download

Sample Output  Download

Tags




Discuss