package com.luogu.test;
/*
* 计算 s = 1! + 2! + ... + n!
*
* 100分
*/
import java.math.BigInteger;
import java.util.Scanner;
public class P1009FactorialAdd {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger s = BigInteger.ZERO;
BigInteger a = BigInteger.ONE;
for (int i = 1; i <= n; i++) {
a = a.multiply(new BigInteger(Integer.toString(i)));
s = s.add(a);
}
System.out.println(s.toString());
}
}
biginteger 的应用