#include using namespace std; int main() { int n; long long C; cin >> n; C = 1LL + 3LL * n * (n - 1); cout << C; return 0; }