#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int mo=100003;
long long pow(long long a,long long b)
{
long long ans=1;
while(b){
if(b&1)ans*=a;
a*=a;
a%=mo;ans%=mo;
b/=2;
}
return ans%mo;
}
long long n,m;
int main()
{
freopen("prisona.in","r",stdin);
freopen("prisona.out","w",stdout);
scanf("%lld%lld",&m,&n);
long long gg=pow(m,n);
long long qwq=(m*pow(m-1,n-1))%mo;
printf("%lld",(gg-qwq+mo)%mo);
return 0;
}