简单组合数学。
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
typedef long long LL;
const LL MOD=100003;
LL pow(LL n, LL p)
{
LL ans=1;
while(p) {
if(p&1) ans=ans*n%MOD;
n=n*n%MOD;
p>>=1;
}
return ans;
}
void read(LL &x)
{
char c;
while((c=getchar())<'0' || c>'9');
x=c-'0';
while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+c-'0';
}
int main()
{
LL n, m;
read(m), read(n);
LL ans=pow(m, n);
ans=(ans+MOD-m*pow(m-1, n-1)%MOD)%MOD;
printf("%lld\n", ans);
return 0;
}