#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long int n, ans, i, j, k;
  cin >> n;
  if (n == 0) {
    cout << "1" << endl;
    return 0;
  }
  ans = 2 * n * n;
  ans = ans + ((n + 2) * (n + 1)) - 1;
  cout << ans << endl;
  return 0;
}
