#include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<iomanip> #include<ctime> #include<queue> #include<stack> #define rg register #define lst long long #define N 1050 #define mod 10007 using namespace std; lst a,b,k,n,m,ans; lst f[N][N]; inline lst read() { rg lst s=0,m=1;rg char ch=getchar(); while(ch!=‘-‘&&(ch<‘0‘||ch>‘9‘))ch=getchar(); if(ch==‘-‘)m=-1,ch=getchar(); while(ch>=‘0‘&&ch<=‘9‘)s=(s<<3)+(s<<1)+ch-‘0‘,ch=getchar(); return s*m; } inline lst qpow(rg lst x,rg lst y) { rg lst res=1,base=x; while(y) { if(y&1)res=(res*base)%mod; base=(base*base)%mod; y>>=1; } return res; } int main() { a=read(),b=read(),k=read(),n=read(),m=read(); ans=(qpow(a,n)*qpow(b,m))%mod; f[1][1]=1; for(rg lst i=2;i<=k+1;++i) for(rg lst j=1;j<=i;++j) { f[i][j]=(f[i-1][j-1]+f[i-1][j])%mod; } if(n+m==k) { ans=(ans*f[k+1][k-n+1])%mod; } else ans=0; cout<<ans<<endl; return 0; }