由于数据太2,一开始用 int读成功贡献了3个WA TAT
#include<iostream>
#include<cstdio>
#include <math.h>
using namespace std;
long long ksm(long long k,long long a)
{
if(k==0)return 1;
if(k==1)return a;
if(k % 2 == 0)return ksm(k/2,a)*ksm(k/2,a) % 100003;
else return (ksm(k-1,a)*a) % 100003;
}
int main()
{
long long m=0,n=0,ans;
scanf("%lld%lld",&m,&n);
ans=(ksm(n,m)-(m*ksm(n-1,m-1))% 100003 +100003)%100003;
printf("%lld",ans);
return 0;
}