#include using namespace std; int main() { long N, M = 1e12, L = 1, F = 0; cin >> N; 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"; }