#!/bin/python3 import sys def sumOfGroup(k): # Return the sum of the elements of the k'th group. n = int(((k-1)*(k))/2) t=0 s = n*2+1 for i in range(0, k): t+=s s+=2 return t; if __name__ == "__main__": k = int(input().strip()) answer = sumOfGroup(k) print(answer)