#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
template <class T>
double sqrt(T x) {
  return sqrt((double)x);
}
template <class T>
T sqr(T x) {
  return x * x;
}
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
void wa() {
  cout << 5;
  exit(0);
}
void tl() {
  while (1)
    ;
}
void pe() {
  cout << "abc abc\n 453534 wff sf sd\n";
  exit(0);
}
void re() { exit(1); }
void ml() { int *b = new int[1000]; }
int main() {
  double TIME_START = clock();
  int n;
  cin >> n;
  unsigned long long ans = 1, lay;
  if (n >= 2) {
    lay = 12;
    for (int x = 2; x <= n; x++) {
      ans += lay;
      lay += 12;
    }
  }
  cout << ans;
  fprintf(stderr, "\n\n%.15lf\n\n",
          (double)(clock() - TIME_START) / CLOCKS_PER_SEC);
  return 0;
}
