#include <bits/stdc++.h>
using namespace std;
int sky(int n) {
  int count = 1, acount = 12;
  if (n == 1) return 1;
  if (n >= 2) {
    count += acount;
    for (int i = 2; i < n; i++) {
      count += (acount * i);
    }
  }
  return count;
}
int main() {
  int n;
  cin >> n;
  cout << sky(n) << endl;
}
