#include <iostream>using namespace std;int main(){ int N = 0; while(cin>>N){ cout<<((2+2+(N-1)*3)*N/2)<<endl; }}