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