import sys
n=int(sys.stdin.readline())
r=0
if n%2==0:
    r=n//2
else:
    r=3*n+1
print(r)