#include <bits/stdc++.h>
#include <iomanip>
#include <string>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    if(n%2==0){
        cout<<n/2;
    }
    else{
        cout<<3*n+1;
    }
    return 0;
}