#include <iostream> using namespace std; int main() { int a; while (cin >> a) { cout << (3 * a + 1)*(a % 2 == 1) + (a / 2)*(a % 2 == 0) << endl; } }