n = int(input()) result = 0 for i in range(1,n+1): if i % 3 == 1: result += i elif i % 3 == 2: result += i ** 2 else: result += i ** 3 print(result)