a = int(eval(input()))

t = [0]*1000000

t[a] = 1

for i in range(2,1000001):

    if a % 2 == 0:

        a //= 2

    else:

        a = 3*a + 1

    if t[a]:

        break

    t[a] = 1

print(i)
a = int(eval(input()))

t = set()

t.add(a)

for i in range(2,1000001):

    if a % 2 == 0:

        a //= 2

    else:

        a = 3*a + 1

    if a in t:

        break

    t.add(a)

print(i)
a = int(eval(input()))
t = [0] * 1000000
t[a] = 1
for i in range(2, 1000001):
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    if t[a]:
        break
    t[a] = 1
print(i)

a = int(eval(input()))
t = set()
t.add(a)
for i in range(2, 1000001):
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    if a in t:
        break
    t.add(a)
print(i)

-t = [0] * 1000000 -t[a] = 1 +t = set() +t.add(a) -    if t[a]: +    if a in t: -    t[a] = 1 +    t.add(a)