#!/bin/python import sys def sumOfGroup(k, tempSet): prev = 0 for i in range(0, k): prev += i #print 2*prev+1 #for i in tempSet.keys(): # if i == k: # return tempSet[k] curr = 2*prev + 1 temp_sum = 0 for i in range(0, k): temp_sum += curr curr += 2 return temp_sum # Return the sum of the elements of the k'th group. if __name__ == "__main__": tempSet = {} curr = 1 k = 1 index = 0 tempSum = 0 while(1): if curr > 1000000: break if index < k: tempSum += curr index+=1 else: index = 1 tempSet[k] = tempSum tempSum = curr k+=1 curr += 2 k = int(raw_input().strip()) answer = sumOfGroup(k, tempSet) print answer