#include <cstdio>
#include <cmath>
#define m 1000000000
int main()
{
	__int64 sum;
	int n;
	while(~scanf("%d",&n))
	{
		sum=1;
		for(int i=1;i<=n;i++)
		{
			sum*=i;
			sum=sum%(m+7);
		}
		printf("%I64d\n",sum);
	}
}