object Main extends App{
  import scala.io.StdIn.readInt
  
  val m = readInt

  def f(x:Long):Long ={
  	if(x % 2 == 0)return x/2
    else return 3*x + 1
  }
  
  def g(acc:List[Long],x:Long):List[Long] =
  	x match{
      case 4 => acc
      case _ => g(acc :+ f(x),f(x))
  }
  if(m == 1){println("4")}
  else if(m == 2){println("4")}
  else println(g(Nil,m).toString)
}
