#include <cstdint>
#include <iostream>

using ll  = int64_t;

constexpr ll maxk = 1e3,P=10007;
ll C[maxk+5][maxk+5],a,b,k,n,m;

ll mult(ll const&a,ll const&b){
    return a*b%P;
}

ll qpow(ll b,ll e){
    ll r{1};
    while(e){
        if(e&1)r=r*b%P;
        b=b*b%P;
        e/=2;
    }
    return r;
}

#define PV(v){std::cout<<#v<<" :"<<(v)<<"\n";}

int main(){
    std::cin>>a>>b>>k>>n>>m;
    for(ll i{0};i<=maxk;i++){
        C[i][0]=C[i][i]=1;
        for(ll j{1};j<i;j++){
            C[i][j]=(C[i-1][j]+C[i-1][j-1])%P;
        }
    }
    // PV(C[k][m])
    // PV(qpow(a, n))
    // PV(qpow(b, m))
    std::cout<<mult(mult(C[k][m], qpow(a, n)), qpow(b, m))<<'\n';
}