#include #include #include #include #include #include #include #include #include #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define P pair //#define MOD 1000000007 #define INF 1012345678 #define NINF (-2147483647-1) #define LLINF 9223372036854775807 using ll = long long; using namespace std; //powMod ll powMod(ll k, ll n, ll mod) { ll x = 1; while (n > 0) { if (n & 1) { x = x * k % mod; } k = k * k % mod; n >>= 1; } return x; } int main() { const int MOD = 1000003; int x, N; cin >> x >> N; ll sum = 0; vector a(N); for (int i = 0; i < N; i++) { ll a; cin >> a; sum += powMod(x, a % (MOD - 1), MOD); sum %= MOD; } cout << sum << endl; getchar(); getchar(); return 0; }