N=int(input()) ans=0 for k in range(1,N+1): ans+=k**((k-1)%3+1) print(ans)