#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod = 100003;
typedef long long LL;
LL qpower(LL a, LL b)
{
LL res = 1;
while(b)
{
if(b & 1)res = res * a % mod;
b >>= 1;
a = (LL)a * a % mod;
}
return res;
}
int main()
{
LL n, m; cin >> m >> n;
// cout << qpower(m, n) << " " << m * qpower(m - 1, n - 1) << endl;
cout <<((qpower(m, n) - m * qpower(m - 1, n - 1)) % mod + mod )% mod<< endl;
return 0;
}