#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ull = unsigned long long; using PII = pair; using PLL = pair; template ostream& operator<<(ostream& s, const pair& p) { return s << "(" << p.first << ", " << p.second << ")"; } template ostream& operator<<(ostream& s, const vector& v) { s << "["; for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i]; s << "]"; return s; } #define ALL(a) (a).begin(), (a).end() const ll MOD = 1000000000000LL; int main() { ll n; cin >> n; ll i = 1, val = 1; while (i <= n && val != 0) { val = (val * i) % MOD; i++; } if (n >= 20) { printf("%012lld\n", val); } else { cout << val << endl; } return 0; }