#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,k,n,m,c[1010][1010];
const int mod=10007;
ll pow(ll x,ll y,ll mo){
if(y==0) return 1;
ll res=pow(x,y/2,mo);
if(y&1) res=res*res*x%mo;
else res=res*res%mo;
return res;
}
int main(){
scanf("%lld%lld%lld%lld%lld",&a,&b,&k,&n,&m);
c[0][0]=1;
for(int i=1;i<=k;i++) c[i][0]=c[i][i]=1;
for(int i=1;i<=k;i++)
for(int j=1;j<i;j++)
c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
ll ans=c[k][m]*pow(a,n,mod)*pow(b,m,mod)%mod;
cout<<ans<<endl;
return 0;
}
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,k,n,m,c[1010][1010];
const int mod=10007;
ll pow(ll x,ll y,ll mo){
if(y==0) return 1;
ll res=pow(x,y/2,mo);
if(y&1) res=res*res*x%mo;
else res=res*res%mo;
return res;
}
int main(){
scanf("%lld%lld%lld%lld%lld",&a,&b,&k,&n,&m);
c[0][0]=1;
for(int i=1;i<=k;i++) c[i][0]=c[i][i]=1;
for(int i=1;i<=k;i++)
for(int j=1;j<i;j++)
c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
ll ans=c[k][m]*pow(a,n,mod)*pow(b,m,mod)%mod;
cout<<ans<<endl;
return 0;
}