#include <iostream>
#include <cstdio>
using namespace std;
const long long mask=10007LL;
long long a,b,k,n,m,f[1010][1010],ans=1;
int i,j;
int main()
{
freopen("factor.in","r",stdin);
freopen("factor.out","w",stdout);
cin>>a>>b>>k>>n>>m;
f[1][0]=f[1][1]=1;
for (i=2;i<=k;i++)
{
f[i][0]=1;
for (j=1;j<=i;j++)
f[i][j]=(f[i-1][j-1]+f[i-1][j])%mask;
}
ans=f[k][m];
for (i=1;i<=n;i++)
ans=(ans*(a%mask))%mask;
for (i=1;i<=m;i++)
ans=(ans*(b%mask))%mask;
cout<<ans<<endl;
fclose(stdin);
fclose(stdout);
return 0;
}