RT,
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll cnt;
const int mod=100003;
int quick_pow(ll m,ll n) {
ll ans=1;
while(n) {
if(n&1)
ans=m*ans%mod;
m=m*m%mod;
n/=2;
}
return ans;
}
int main() {
int a,b;
cin>>a>>b;
cnt+=quick_pow(a,b)%mod;
cnt-=(a*quick_pow(a-1,b-1))%mod;
while(cnt<0) cnt+=mod;
cout<<cnt%mod<<endl;
return 0;
}