#include <cstdio>
using namespace std;
const int N = 1005;
const int mod = 10007;
#define int long long
int c[N][N];
int a, b, k, n, m;
int pow(int x, int y) {
int ans = 1, pas = x;
while (y) {
if (y & 1) ans = ans * pas % mod;
pas = pas * pas % mod;
y >>= 1;
}
return ans;
}
int dfs(int n, int m) {
if (!m) return c[n][m] = 1;
if (m == 1) return c[n][m] = n;
if (c[n][m]) return c[n][m];
if (n - m < m) m = n - m;
return c[n][m] = (dfs(n - 1, m) + dfs(n - 1, m - 1)) % mod;
}
signed main() {
scanf("%lld%lld%lld%lld%lld", &a, &b, &k, &n, &m);
c[1][0] = c[1][1] = 1;
a %= mod, b %= mod;
int ans = 1;
ans = (ans * pow(a, n)) % mod;
ans = (ans * pow(b, m)) % mod;
if (n > m) n = m;
ans = (ans * dfs(k, n)) % mod;
printf("%lld\n", ans);
}
/**
* @file uva/10910/main.cpp
* @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
* @brief 一个学生选修了 N 门课程,
* 一共得到了 T 分
* 已知他都及格了
* 给出各门课程的及格分数线
* 问该学生可能的成绩组合的种类数
* @version 0.1
* @date 2022-04-29
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int tc;
cin >> tc;
while (tc--) {
ll x, y, z;
cin >> x >> y >> z;
y -= x * z;
ll ans = 0;
if (y >= 0) {
ans = 1;
ll now = y + x - 1 - max(x - 1, y);
ll tot = 1;
for (int i = 1; i <= now; ++i) {
tot *= i;
ans *= (y + x - i);
ll hel = __gcd(tot, ans);
tot /= hel;
ans /= hel;
}
}
cout << ans << endl;
}
}
#include <cmath>
#include <cstdio>
#include <cstring>
int m, n, a[1000010], p[1000010], now[1000010], ans[1000010];
int main() {
int i, j, k, x, y, z, tot = 0, cnt = 0;
bool flag;
scanf("%d%d", &n, &m);
x = sqrt(m + 0.5);
for (i = 2; i <= x; i++)
if (m % i == 0) {
a[++tot] = i;
while (m % i == 0) {
m /= i;
p[tot]++;
}
}
if (m > 1) {
a[++tot] = m;
p[tot] = 1;
}
for (i = 1; i < n - 1; i++) {
x = n - i;
y = i;
for (j = 1; j <= tot; j++)
while (x % a[j] == 0) {
x /= a[j];
now[j]++;
}
for (j = 1; j <= tot; j++)
while (y % a[j] == 0) {
y /= a[j];
now[j]--;
}
flag = 1;
for (j = 1; j <= tot; j++)
if (p[j] > now[j]) {
flag = 0;
break;
}
if (flag) ans[++cnt] = i + 1;
}
printf("%d\n", cnt);
for (i = 1; i <= cnt; i++) printf("%d%c", ans[i], i == cnt ? '\n' : ' ');
}