#T618. 1~N的阶乘和

1~N的阶乘和

Description

Calculate the value of Sn=1!+2!+3!+4!+5!+…+n!, where n is a number.


Note: Since n can be relatively large, Sn should be defined as a long long type.

Input Format

Input an integer N.

Output Format

Output a number representing the sum of factorials from 1 to N.

That is: Sn=1!+2!+3!+4!+5!+…+n!


Note: If using printf, the output format specifier should be %lld.

```input1 5 ``` ```output1 153 ``` ## Source

CodesOnline