using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { const int MOD = 1000003; static void Main() { int x, N; string[] s = Console.ReadLine().Split(' '); x = int.Parse(s[0]); N = int.Parse(s[1]); int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); long cnt = 0; for(int i = 0; i < N; i++) { cnt = (cnt + MyPow(x, a[i])) % MOD; } Console.WriteLine(cnt); } static long MyPow(long a,long b) { long res = 1; while (b > 0) { if (b % 2 == 0) { a = (a * a) % MOD; b /= 2; } else { res = (res * a) % MOD; b--; } } return res; } }