#include <bits/stdc++.h>
using namespace std;
int n;
long long s, x;
int main() {
  srand(time(NULL));
  cin >> n;
  n--;
  s = 1;
  x = 12;
  while (n) {
    s += x;
    x += 12;
    n--;
  }
  cout << s << endl;
  return 0;
}
