#include <bits/stdc++.h>
using namespace std;
string tostr(int n) {
  stringstream rr;
  rr << n;
  return rr.str();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  if (n == 0) {
    cout << 0 << endl;
  } else if ((n + 1) % 2 == 0) {
    cout << (n + 1) / 2 << endl;
  } else {
    cout << n + 1 << endl;
  }
  return 0;
}
