#include using namespace std; int main() { long N, M = 1e12, L = 1, F = 0; cin >> N; if (N >= 50) return cout << "000000000000" << "\n", 0; while (N) { L *= N, N--; if (L > M) L %= M, F = 1; } if (F) cout << setfill('0') << setw(12) << L % M <<"\n"; else cout << L << "\n"; }