#include<bits/stdc++.h>
using namespace std;
long long a,b,k,n,m;
long long ans=1;
const long long mod=10007;
const long long MOD=10007*100000;
long long f[1003][1003];
int main()
{
freopen("factor.in","r",stdin);
freopen("factor.out","w",stdout);
cin>>a>>b>>k>>n>>m;
long long aa=1,bb=1;
for(int i=1;i<=n;i++)
{
aa=(aa*a%mod+mod)%mod;
}
for(int i=1;i<=m;i++)
{
bb=(bb*b%mod+mod)%mod;
}
f[1][0]=f[1][1]=1;
for (int i=2;i<=k;i++)
{
f[i][0]=1;
for (int j=1;j<=i;j++)
f[i][j]=(f[i-1][j-1]+f[i-1][j])%mod;
}
ans=f[k][m];
ans=((aa*bb%mod)*ans+mod)%mod;
cout<<ans;
return 0;
}