#include <iostream>
#define COEF 10000000
#define TEN 10
using namespace std;
unsigned int arr[] = { 1, 94194688,80754176,28792576,93638144,44194688,16269824,94550272,61946112,68933632,
68754176,19323648,22612992,36351232,57997312,66792576,2167808,95748096,88043776,
37690112,65638144,99247872,80831232,42968832,38960896,2194688,36401664,29433088,
21091328,35679232,40269824,3200512,39416576,62174976,23727104,49750272,52626176,
72337664,68916224,93513984,25146112,14722816,60257024,2170112,13989632,28933632,
91983872,29619968,23259904,52859904,2354176,61171456,14485248,81225984,93129472,
98123648,42294528,83940096,91339008,90945024,77812992,83786752,30308352,33122816,
709376,45551232,13495552,4053504,28486912,65094912,93197312,79194112,80894208,
48729344,89670656,26832576,59147776,51826688,14217984,72698112,10487808,29000448,
21455616,72560128,94383616,23588096,83462144,14917632,85698816,11810304,3083776,
84299264,11034368,6525952,27101696,68170112,92235008,45980416,15386112,44244224,
3398144 };
int main()
{
int N;
unsigned long long factorial = 1;
cin >> N;
int idx = N/COEF;
factorial = arr[idx];
int start = !N%COEF ? idx*COEF : idx*COEF + 1;
if (N % COEF != 0)
{
for(int i = start; i <= N; i++)
{
factorial *= i;
while(factorial % TEN == 0) factorial /= TEN;
factorial %= COEF;
}
}
factorial %= TEN*TEN*TEN;
cout << factorial/(TEN*TEN) << (factorial/TEN)%TEN << factorial%TEN;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKI2RlZmluZSBDT0VGIDEwMDAwMDAwCiNkZWZpbmUgVEVOIDEwCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdW5zaWduZWQgaW50IGFycltdID0geyAxLCA5NDE5NDY4OCw4MDc1NDE3NiwyODc5MjU3Niw5MzYzODE0NCw0NDE5NDY4OCwxNjI2OTgyNCw5NDU1MDI3Miw2MTk0NjExMiw2ODkzMzYzMiwKICAgICAgICAgICAgICAgICAgICAgICA2ODc1NDE3NiwxOTMyMzY0OCwyMjYxMjk5MiwzNjM1MTIzMiw1Nzk5NzMxMiw2Njc5MjU3NiwyM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