作者:
asdypeij
,
2022-09-06 21:16:04
,
所有人可见
,
阅读 5
// Problem: P1313 [NOIP2011 提高组] 计算系数
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1313
// Memory Limit: 125 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
#define F(i,j,k) for (signed i=signed(j);i<=signed(k);i++)
#define endl '\n'
#define int long long
const int mod=10007;
int a,b,k,n,m;
int qPow(int a,int b){
int ans=1;
while(b){
if(b%2) (ans*=a)%=mod;
(a*=a)%=mod,b/=2;
}
return ans;
}
int inv(int x){return qPow(x,mod-2);}
int P(int a,int b){//从b个数中选a个数的个数
int ans=1;
for(int i=b,j=1;j<=a;i--,j++) (ans*=i)%=mod;
return ans;
}
int fac(int x){return x==1?1:x*fac(x-1)%mod;}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>a>>b>>k>>n>>m;
cout<<qPow(a,n)*qPow(b,m)%mod*P(n,k)%mod*inv(fac(n))%mod<<endl;
return 0;
}