#!/bin/python import sys def sumOfGroup(k): # Return the sum of the elements of the k'th group. res=(((k*(k-1))/2)*2)+1 count=0 x=res while count<(k-1): x+=2 res+=x count+=1 return res if __name__ == "__main__": k = int(raw_input().strip()) answer = sumOfGroup(k) print answer