• 本题小技巧:学会实用字典保存中间的运算结果,避免重复计算,提升效率
x = int(input())
dict_1 = {1:1}
sum_1 = 1
for i in range(2,x+1):
    s_1 = dict_1[i-1] * i
    dict_1[i]=s_1
    sum_1 = sum_1 + s_1
if x == 1:
    print(1)
else:
     print(sum_1)