#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
int main() {
  long long out = 0, a, b;
  cin >> a;
  if (a == 1)
    out = 1;
  else {
    out = 1;
    b = 12;
    for (int i = 1; i < a; i++) {
      out += b;
      b += 12;
    }
  }
  cout << out;
  return 0;
}
