#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define ll long long
#define MAX 1000100
int n;
ll mod;
void input(){
scanf("%d", &n);
}
ll mul(ll a,ll b){
if(b == 0) return 0;
if(b == 1) return a % mod;
ll m = mul(a, b / 2);
m = (m + m) % mod;
if(b & 1) m = (m + a) % mod;
return m;
}
void process(){
if(n >= 587117){
printf("0");
return;
}
ll ans = 1, gt = 1;
mod = 109546051211;
for(ll i = 1; i <= n; i++){
gt = mul(gt, i);
ans = mul(ans, gt);
}
printf("%lld", ans);
}
int main(){
//freopen("in.txt", "r", stdin);
input();
process();
return 0;
}
ICAgICNpbmNsdWRlIDxzdGRpby5oPgogICAgI2luY2x1ZGUgPHN0cmluZy5oPgogICAgI2luY2x1ZGUgPGlvc3RyZWFtPgogICAgI2luY2x1ZGUgPHN0cmluZz4KICAgICNpbmNsdWRlIDxhbGdvcml0aG0+CiAgICAjaW5jbHVkZSA8bWFwPgogICAgI2luY2x1ZGUgPHZlY3Rvcj4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICAjZGVmaW5lIGxsIGxvbmcgbG9uZwogICAgI2RlZmluZSBNQVggMTAwMDEwMAogICAgIAogICAgaW50IG47CiAgICBsbCBtb2Q7CiAgICAgCiAgICB2b2lkIGlucHV0KCl7CiAgICAJc2NhbmYoIiVkIiwgJm4pOwogICAgfQogICAgIAogICAgbGwgbXVsKGxsIGEsbGwgYil7CiAgICAJaWYoYiA9PSAwKSByZXR1cm4gMDsKICAgIAlpZihiID09IDEpIHJldHVybiBhICUgbW9kOwogICAgCWxsIG0gPSBtdWwoYSwgYiAvIDIpOwogICAgCW0gPSAobSArIG0pICUgbW9kOwogICAgCWlmKGIgJiAxKSBtID0gKG0gKyBhKSAlIG1vZDsKICAgIAlyZXR1cm4gbTsKICAgIH0KICAgICAKICAgIHZvaWQgcHJvY2VzcygpewogICAgCWlmKG4gPj0gNTg3MTE3KXsKICAgIAk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