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