#include #include #include using namespace std; int main() { long long n; cin >> n; long long ans = 1; long long mod = 1e12; bool over = false; for (long long i = 1; i <= n; i++) { ans *= i; if (ans >= mod) { over = true; } ans %= mod; if (ans == 0) { cout << string(12, '0') << endl; return 0; } } if (over) { string s = to_string(ans); while (s.size() < 12) { s = "0" + s; } cout << s << endl; } else { cout << ans << endl; } }