while True:
try:
num = int(input('Введите любое целое число: '))
break
except ValueError:
pass
while num == 0:
if num % 2 == 0:
num = num / 2
print(num)
else:
num = num * 3 + 1
print(num)