N = int(input()) j = 1 ans = 0 for i in range(1,N+1): ans += pow(i,j) j += 1 if j > 3: j = 1 print(ans)