n = int(input())
if n%2 ==0:
    print(int(n/2)) # 除法 “/” 必为浮点运算
else:
    print(3*n+1) # 乘法 “*” 结果类型由操作数决定