#include <bits/stdc++.h>
using namespace std;
const int maxN = 30 + 321;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  long long ans = 0;
  if (n == 1) {
    cout << '1' << endl;
    return 0;
  }
  ans = 1;
  for (int i = 2; i <= n; i++) ans += 11 * (i - 1) + i - 1;
  cout << ans << endl;
  return 0;
}
