#include using namespace std; typedef long long LL; const LL MOD = 1e12; int main() { // 1. 入力情報取得. LL N; cin >> N; // 2. N! を 10 の 12乗 で割った余りは? // 階乗計算 早見表. // https://www.nap.st/factorial_calculation/?lang=ja // 50! = 30414093201713378043612608166064768844377641568960512000000000000 // -> 上記サイトから, 50! で, はじめて下12桁が, 000000000000 となる. // なので, N が 50以上 であれば, 000000000000 が解答のはず. // 2-1. N >= 50 の 場合. if(N >= 50){ cout << "000000000000" << endl; return 0; } // 2-2. N < 50 の 場合. LL ans = 1; // for(int i = 1; i <= N; i++) ans *= i, ans %= MOD; // for(LL i = 1; i <= N; i++) ans *= i, ans %= MOD; // -> test7.txt, test8.txt で, WAとなったので, いったん修正. for(LL i = N; i > 1; i--) ans *= i, ans %= MOD; cout << ans << endl; // 3. 後処理. return 0; }