#include <iostream>
using namespace std;

int main() {
	int n;
	int times=1;
	cin>>n;
	cout<<n;
	while(n!=1){
	    if(n%2==0){
	    	n=n/2;
	    }
	    else{
	    	n=3*n+1;
	    }
	    times=times+1;
	    cout<<","<<n;
	}
	cout<<endl<<"共"<<times<<"項"<<endl;
	return 0;
}