显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL mod=10007ll;
LL A,B,K,N,M;
LL qpow(LL x,LL y)
{
LL ans=1ll;
while(y)
{
if(y&1ll)ans*=x,ans%=mod;
x*=x,x%=mod,y>>=1ll;
}
return ans;
}
LL C[1010][1010];
int main()
{
freopen("factor.in","r",stdin);
freopen("factor.out","w",stdout);
scanf("%lld%lld%lld%lld%lld",&A,&B,&K,&N,&M);
C[0][0]=1;
for(int i=1;i<=K;i++)
for(int j=0;j<=i;j++)
C[i][j]=j==0||j==i?1:C[i-1][j]+C[i-1][j-1],C[i][j]%=mod;
printf("%lld",(((qpow(A,N)*qpow(B,M))%mod)*C[K][M])%mod);
fclose(stdin);
fclose(stdout);
return 0;
}