#include <cstdio>
#define LL long long
const int mod = 10007;
LL f[1010];
LL qmi(LL a, int b) {
LL res = 1;
while (b) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
int main() {
int a, b, k, n, m;
scanf("%d %d %d %d %d", &a, &b, &k, &n, &m);
f[0] = 1;
for (int i = 1; i <= k; i ++)
f[i] = f[i - 1] * i % mod;
LL ans = f[k] * qmi(f[k - n], mod - 2) % mod * qmi(f[n], mod - 2) % mod * qmi(a, n) % mod * qmi(b, m) % mod;
printf("%lld", ans);
return 0;
}
一本通1648:【例 1】「NOIP2011」计算系数
最新推荐文章于 2024-08-12 19:18:27 发布