#include<iostream>

using namespace std;

int main(){
    int N;
    while(cin>>N)
        cout<<(3*N+1)*N/2<<endl;

    return 0;
}