88的雷达2+2+1=5

yang_zhiyu 2023-11-11 10:40:26

#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
    ll s=0;
    bool f=0;
    char ch=' ';
    while(!isdigit(ch))
    {
        f|=(ch=='-'); ch=getchar();
    }
    while(isdigit(ch))
    {
        s=(s<<3)+(s<<1)+(ch^48); ch=getchar();
    }
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0)
    {
        putchar('-'); x=-x;
    }
    if(x<10)
    {
        putchar(x+'0');    return;
    }
    write(x/10);
    putchar((x%10)+'0');
    return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
const int Mod=10007;
const int N=1005;
ll Jiec[N];
inline ll Ksm(ll x,ll y)
{
    x%=Mod;
    ll ans=1;
    while(y)
    {
        if(y&1) ans=ans*x%Mod;
        x=x*x%Mod;
        y>>=1;
    }
    return ans;
}
inline ll C(ll n,ll m)
{
    return Jiec[n]*Ksm(Jiec[m],Mod-2)%Mod*Ksm(Jiec[n-m],Mod-2)%Mod;
}
int main()
{
    int i,j;
    int a,b,k,n,m;
    R(a); R(b); R(k); R(n); R(m);
    Jiec[0]=1;
    for(i=1;i<=k;i++) Jiec[i]=Jiec[i-1]*i%Mod;
    Wl(Ksm(a,n)*Ksm(b,m)%Mod*C(n+m,n)%Mod);
    return 0;
}