import java.util.Scanner; import java.util.ArrayList; public class Re_AdditionOfPower{ final static long MOD = 1000003; public static void main(String[] args){ Scanner scanner = new Scanner(System.in); long X = Input(scanner.nextInt() , 1 , 100); long N = Input(scanner.nextInt() , 1 , 100); long Result = 0; ArrayList Index = new ArrayList<>(); for(int i = 0 ; i < N ; i++){ long A = Input(scanner.nextInt() , 0 , 100000000); Index.add(A); } for(int j = 0; j < N; j++) { Result += Processing(X, (int)(long)Index.get(j)) % MOD; } System.out.println(Result % MOD); } //値の条件判定を行い可であれば値を返却するメソッド public static int Input(int Number , int Min ,int Max){ try{ if(Number < Min || Number > Max){ System.out.println(Number + "は" + Min + "以上" + Max + "以下で入力してください"); System.exit(0); } }catch(Exception E){ System.out.println("想定外のエラーです"); System.exit(0); } return Number; } //累乗処理を行うメソッド public static long Processing(long X, int N) { long Result = 1; for (; N > 0; N /= 2) { Result = (N & 1) == 1 ? (X * Result) % MOD : Result; X = (X * X) % MOD; } return Result; } }