循环

n = int(input())

sum = 0
for i in range(1,n+1):
    for j in range(1,i+1):
        sum += j

print(sum)

递龟

def a(n):  # 通项公式
    if n == 1:
        return 1
    return n + a(n-1)

def s(n):  # 前n项和
    if n == 1:
        return 1
    return a(n) + s(n-1)


n = int(input())
print(s(n))