快速幂
import java.util.Scanner;
public class Main {
public static long M,N;
public static int MOD=100003;
public static long pow(long a, long b){
if (b==0){
return 1;
}
long target = pow(a,b/2);
if (b%2==1){
return ((target*target)%MOD*a)%MOD;
}else {
return (target*target)%MOD;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
M = sc.nextLong();
N = sc.nextLong();
long total = 1;
long target = M;
total = pow(M,N);
target = (pow(M-1,N-1)*M)%MOD;
System.out.println((MOD+total-target)%MOD);
}
}