using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static Dictionary cache = new Dictionary(); static long sumOfGroup(int k) { // Return the sum of the elements of the k'th group. long result; if (!cache.TryGetValue(k, out result)) { long kk = k - 1; long startIndex = (kk * (kk + 1)) / 2; //Console.WriteLine("si"+startIndex); long b = startIndex*2 + 1; //Console.WriteLine("b"+b); result = b * k + (kk * (kk + 1)); cache[k] = result; } return result; } static void Main(String[] args) { int k = Convert.ToInt32(Console.ReadLine()); long answer = sumOfGroup(k); Console.WriteLine(answer); } }