https://www.luogu.com.cn/record/89002249
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll mod = 1e17;
ll n, high, low, ht, lt;
int main(){
cin >> n;
for (int i = 1;i <= n; i ++) {
ht = 0, lt = 1;
for (int j = 1; j <= i; j ++) {
lt *= j, ht *= j;
ht += lt / mod, lt %= mod;
}
high += ht, low += lt;
high += low / mod, low %= mod;
}
if (high) cout << high;
cout << low << '\n';
return 0;
}