#include <stdio.h>

int main() {
    int n,c;
    scanf("%d",&n);
    c = n%2==0?n/2:3*n+1;
    printf("%d",c);
    return 0;
}