python效率极低
n=input()
ans=(n**(n-2))%9999991
for i in range(1,n):
ans=(ans*i)%9999991
print ans%9999991
C++秒过
#include<cstdio>
#define mod 9999991
int n;long long ans=1;
int main(){
scanf("%d",&n);
for(int i=1;i<=n-2;i++)
ans=(ans*n)%mod;
for(int i=1;i<=n-1;i++)
ans=(ans*i)%mod;
printf("%lld",ans);
return 0;
}