a=0 for i in range(int(input())): i+=1 a+=i**(i%3+1) print(a)