//高精度阶乘
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAXN=3000;
struct node
{
int f[MAXN];//阶乘后大整数
int maxn; //位数=maxn-1;maxn=最高位数
};
node highPrecisionFactorial(int n)
{
node fd;
fd.maxn=1;
int i,j,c,s;
int f[MAXN];
memset(f,0,sizeof(f));
f[0]=1;
for(i=2;i<=n;i++)
{
c=0;
for(j=0;j<MAXN;j++)
{
s=f[j]*i+c;
f[j]=s%10;
c=s/10;
}
}
for(j=MAXN-1;j>=0;j--) if(f[j]) break;
for(i=j;i>=0;i--)
{
fd.f[fd.maxn++]=f[i];
}
return fd;
}
int main()
{
node jd;
jd=highPrecisionFactorial(30);
for(int i=1;i<jd.maxn;i++){
cout<<jd.f[i];
}
cout<<endl;
return 0;
}