using C=System.Console;class P{static void Main(){for(int b,n=b=int.Parse(C.ReadLine());b>1;n=n%2>0?3*n+1:n/2)C.WriteLine(b=n);}}