#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int add = 0;
  long long total = 1;
  for (int i = 0; i < n; i++) {
    total += add;
    add += 12;
  }
  printf("%I64d\n", total);
  return 0;
}
