n = int(input())

f = 0

if n % 2 == 1:
    f = 3 * n + 1
else:
    f = n // 2

print(f)