#include <math.h>
#include <iostream>
using namespace std;
typedef long long int_;
int_ pow_ (int_ a, int_ b){
int_ end=1;
for (int i = 0; i < b; i++)
end = end * a;
return end;
}
int main () {
int_ m, n, P;
cin >> m >> n;
P = pow_ (m, n) - m * pow_ (m-1, n-1);
cout << P % 10003 << endl;
return 0;
}
谁能救救我