#include #include #include using std::cin; using std::cout; const char endl = '\n'; const int N = 1005; const int mod = 1e4 + 7; template using number = std::integral_constant; template struct factorial : number(n) * factorial::value % mod> {}; template <> struct factorial<0> : number<1> {}; template constexpr std::array get_factorial_table_impl(std::integer_sequence) { return {factorial::value...}; } template constexpr auto get_factorial_table() { return get_factorial_table_impl(std::make_integer_sequence{}); } template struct inverse : number(mod - (mod / n)) * inverse::value % mod> {}; template <> struct inverse<1> : number<1> {}; template <> struct inverse<0> : number<1> {}; template struct factorial_inverse : number(factorial_inverse::value) * inverse::value % mod> {}; template <> struct factorial_inverse<1> : number<1> {}; template <> struct factorial_inverse<0> : number<1> {}; template constexpr std::array get_factorial_inverse_table_impl(std::integer_sequence) { return {factorial_inverse::value...}; } template constexpr auto get_factorial_inverse_table() { return get_factorial_inverse_table_impl(std::make_integer_sequence{}); } int a, b, k, n, m; constexpr auto fac = get_factorial_table(), inv = get_factorial_inverse_table(); int binpow(int a, int b) { int res = 1; a %= mod; while (b) { if (b & 1) res = 1ll * res * a % mod; a = 1ll * a * a % mod; b >>= 1; } return res; } inline int C(int n, int m) { return 1ll * fac[n] * inv[m] % mod * inv[n - m] % mod; } int main() { std::ios::sync_with_stdio(false); cin.tie(nullptr); cin >> a >> b >> k >> n >> m; cout << static_cast(C(k, n)) * binpow(a, n) % mod * binpow(b, m) % mod << endl; return 0; }