#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<int> mul(vector<int> A, int b) {
    int t = 0;
    vector<int> res;
    for (int i = A.size() - 1; i >= 0; i--) {
        t += A[i] * b;
        res.push_back(t % 10);
        t /= 10;
    }
    while(t){
        res.push_back(t%10);
        t/=10;
    }
    vector<int> res_reverse;
    for (int i = res.size() - 1; i >= 0; i--) 
        res_reverse.push_back(res[i]);
    return res_reverse;
}
int main() {
    int n;
    while (cin >> n) {
        if (n == 0) cout << 1 << endl;
        else {
            string a = to_string(n);
            vector<int> A;
            for (int i = 0; i < a.size(); i++) A.push_back(a[i] - '0'); 
            vector<int> res = A;
            while (n > 1) {
                n--;
                res = mul(res, n);
            }
            for (int i = 0; i < res.size(); i++) cout << res[i];
            cout << endl;
        }

    }
    return 0;
}
// 64 位输出请用 printf("%lld")