s = int(eval(input()))



a = [s]

idx = 1

n = s

while True:

    if n % 2 == 0:

        n = n // 2

    else:

        n = (3*n) + 1

    idx += 1

    

    if n in a: break

    a.append(n)

    

print(idx)
s = int(eval(input()))



ans = [s]

idx = 1

tmp = s

while True:

    if tmp % 2 == 0:

        tmp = tmp//2

    else:

        tmp = (3*tmp) + 1

    idx +=1



    if tmp in ans:

        print(idx)

        exit()

    else:

        ans.append(tmp)
s = int(eval(input()))
a = [s]
idx = 1
n = s
while True:
    if n % 2 == 0:
        n = n // 2
    else:
        n = (3 * n) + 1
    idx += 1
    if n in a:
        break
    a.append(n)
print(idx)

s = int(eval(input()))
ans = [s]
idx = 1
tmp = s
while True:
    if tmp % 2 == 0:
        tmp = tmp // 2
    else:
        tmp = (3 * tmp) + 1
    idx += 1
    if tmp in ans:
        print(idx)
        exit()
    else:
        ans.append(tmp)

-a = [s] +ans = [s] -n = s +tmp = s -    if n % 2 == 0: -        n = n // 2 +    if tmp % 2 == 0: +        tmp = tmp // 2 -        n = (3 * n) + 1 +        tmp = (3 * tmp) + 1 -    if n in a: -        break -    a.append(n) -print(idx) +    if tmp in ans: +        print(idx) +        exit() +    else: +        ans.append(tmp)