def solve(): N=int(input()) X=0 for x in range(1,N+1): if x%3==1: X+=x elif x%3==2: X+=x*x else: X+=x*x*x return X #================================================== print(solve())