#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  cin >> n;
  if (n % 2 == 0)
    cout << (long long)(1 + 3 * n * (n + 1)) << endl;
  else {
    n = (long long)(n / 2);
    cout << (long long)(1 + 12 * n * (n + 1) + 6 * (n + 1)) << endl;
  }
  return 0;
}
