//早上起来刚写的阶乘,发现用100000进比10000进快,但是快不了多少,下面贴代码
#include<stdio.h>
#define N 100000
int a[10000];
int main(){
#ifdef N
int n,cnt,carry=0,i,j;
while(1==scanf("%d",&n)){
for(a[0]=i=cnt=1;i<=n;++i){
for(j=0;j<cnt;++j){
a[j]=a[j]*i+carry;
carry=a[j]/N;
a[j]%=N;
}
while(carry){
a[cnt++]=carry%N;
carry/=N;
}
}
for(printf("%d",a[--cnt]);cnt-->0;)
#if N==100000
printf("%05d",a[cnt]);
#elif N==10000
printf("%04d",a[cnt]);
#elif N==1000
printf("%03d",a[cnt]);
#elif N==100
printf("%02d",a[cnt]);
#elif N==10
printf("%d",a[cnt]);
#else
;
#endif
printf("\n");
}
#endif
return 0;
}