import java.util.Scanner; class Main{ public static long p(long x,long n) { long r; if(1>n) return 1; r=p(x*x%1000003,n/2); if(n%2!=0) r=r*x%1000003; return r; } public static void main(String[] args) { Scanner sc=new Scanner(System.in); long x=sc.nextLong(),n=sc.nextLong(),a,s=0,i; for(i=0;i