Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		k := 0
		for n > 1 {
			if n&1 != 0 {
				n = n+((n+1)>>1)
				k+=2
			} else {
				n >>= 1
				k++
			}
		}
		fmt.Println(k)
	}
}

C++: #include<iostream>

using namespace std;


int main(){
	int n,i,j,k;

	while (1){
		j = 0;
		cin >> n;
		if (n == 0){
			break;
		}

		while (n != 1){
			j++;
			if (n % 2 == 0){
				n = n / 2;
			}else{
				n = n * 3 + 1;
			}
		}
		cout << j << endl;
	}

}

C++: #include <iostream>
using namespace std;

int main(void){
  int n;
  while(cin >> n && n != 0){
    int cnt = 0;
    while(n != 1){
      if(n % 2 == 0) n /= 2;
      else n = 3 * n + 1;
      cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

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

C++: #include <iostream>
using namespace std;

int main()
{
  while(true)
  {
    int n;
    cin >> n;
    if ( n == 0 ) break;

    int i;
    for (i=0; n!=1; i++)
    {
      if ( n%2 == 0 )
      {
        n /= 2;
      }
      else
      {
        n = n * 3 + 1;
      }
    }
    cout << i << endl;
  }
}

C++: #include <iostream>
using namespace std;
int col(int n){
  if(n%2)
    return 3*n+1;
  else
    return n/2;
}
int main(){
  int n,s;
  while(true){
  cin>>n;
  if(!n)
    break;
  s = 0;
  while(n!=1){
    n = col(n);
    s++;
  }
  cout<<s<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
  int n;
  int c;

  while(1){
    cin >> n;
    if(!n)break;

    c = 0;
    while(1){
      if(n==1)break;

      if(n%2){
	n*=3;
	n++;
      }else{
	n/=2;
      }
      c++;
    }

    cout << c << endl;
  }
}

C++: #include<stdio.h>
main(){for(int n,m;scanf("%d",&n),m=0,n;){for(;n-1;++m)n=n%2?3*n+1:n/2;printf("%d\n",m);}}

C++: #include <iostream>
using namespace std;

typedef long long ll;
int n;

int main()
{
    while(cin >> n && n) {
        ll ans = 0;
        while(n != 1) {
            ans++;
            n = (n % 2) ? n * 3 + 1 : n / 2;
        }
        cout << ans << endl;
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

#define MAX 1000002

int step[MAX];

int getStep(int n){
  if(n == 1) return 0;
  if(step[n] != -1) return step[n];

  int next;
  if(n % 2 == 0) next = n / 2;
  else           next = n * 3 + 1;

  return step[n] = getStep(next) + 1;
}

int main(){
  int n;
  fill(step, step + MAX, -1);

  while(cin >> n, n){
    cout << getStep(n) << endl;
  }
}

C++: #include "bits/stdc++.h"
using namespace std;

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int ans=0;
		while(n!=1){
			if(n%2==0){
				n/=2;
			}else{
				n*=3;
				n++;
			}
			ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

int solve(ll n){
    int res = 0;
    while (n != 1){
        if (n & 1) n = n * 3 + 1;
        else n >>= 1;
        res++;
    }
    return res;
}

int main(){
    int n;
    while (cin >> n && n){
        cout << solve(n) << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	long long n,cnt=0;
	while(cin>>n&&n!=0){
		cnt=0;
		while(n!=1){
			if(n%2==0){
				n=n/2;
				cnt++;
			}else{
				n=n*3+1;
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		ll N=in();
		if(!N) break;

		int num=0;
		while(N!=1){
			if(N%2) N = 3LL*N+1LL;
			else N /= 2LL;
			num++;
		}
		out(num);
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while(true){
	cin>>n;
	if(n==0)
		break;
	int i=1;
	while(true){
		if(n==1)
			break;
		if(n%2==0)
			n/=2;
		else{
			n*=3;
			n+=1;
		}
		if(n==1)
			break;
		i++;
	}
	cout<<i<<endl;
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,count;
	while(cin >> n){
		if(n==0) return 0;
		count=0;
		while( n != 1){
			if(n%2 == 0){
				n = n/2;
				count++;
			}
			else{
				n = n*3+1;
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb push_back

using namespace std;

int main() {
	int n = 1;
	while (n != 0) {
		cin >> n;
		int count = 0;
		while (n != 1) {
			if (n % 2 == 0) n /= 2;
			else n = 3 * n + 1;
			count++;
		}
		cout << count << endl;
	}
}

C++: #include <iostream>
using namespace std;
int a[1000001];
int calc(int n)
{
  if(n==1) return 0;
  if(a[n] != 0) return a[n];
  a[n] = ((n % 2) == 0 ? calc(n/2) : calc(3*n+1));
  a[n]++;
  return a[n];
}
int main()
{
  int n;
  for(;;){
    cin >> n;
    if(n==0) break;
    cout << calc(n) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const int SIZE = 1000000;
int X[SIZE], Y[SIZE], H[SIZE], W[SIZE];
int n;

long long solve() {
    long long res = 0;
    for ( int i = 0; i < n; ++ i ) {
        int s = X[i] + Y[i] + H[i];
        if ( s <= 60 && W[i] <= 2 ) {
            res += 600;
        } else if ( s <= 80 && W[i] <= 5 ) {
            res += 800;
        } else if ( s <= 100 && W[i] <= 10 ) {
            res += 1000;
        } else if ( s <= 120 && W[i] <= 15 ) {
            res += 1200;
        } else if ( s <= 140 && W[i] <= 20 ) {
            res += 1400;
        } else if ( s <= 160 && W[i] <= 25 ) {
            res += 1600;
        }
    }
    return res;
}

int main() {
    while ( cin >> n && n ) {
        for ( int i = 0; i < n; ++ i ) {
            cin >> X[i] >> Y[i] >> H[i] >> W[i];
        }
        cout << solve() << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;

int main()
{
	int n;


	while(true){
		int c = 0;
		
		cin >> n;

		if(n==0)
			break;


		for(int i=0 ;n!=1 ;i++){
		
			if(n%2 == 0){
				n = n/2;
				c++;
			}
			else if(n%2 != 0){
				n = 3*n + 1;
				c++;

			}
		}

		cout << c << endl;
	}
	return 0;
}