#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 1;
map<long long, long long> mp, pm;
deque<long long> v, vc, ve;
deque<long long> p, pe;
deque<string> ts, ss;
deque<float> sd;
long long a, b, c, d, e, f, cnt, ans, r, n, l;
double q, t, cnt1;
string g, h, w, o, z, m, s;
char y, u;
bool re, rt;
set<long long> st;
vector<pair<long long, long long> > pr, rp;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(0);
  cin >> a;
  b = a - 1;
  c = b - 1;
  cnt += b * 4;
  cnt += 4 * (c * (c + 1) / 2);
  cnt++;
  cout << cnt;
}
