/* -*- coding: utf-8 -*- * * 16.cc: No.16 累乗の加算 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100; typedef long long ll; const ll MOD = 1000003; /* typedef */ /* global variables */ /* subroutines */ ll powmod(ll a, int n) { // a^n % MOD ll pm = 1; while (n > 0) { if (n & 1) pm = (pm * a) % MOD; a = (a * a) % MOD; n >>= 1; } return pm; } /* main */ int main() { ll x; int n; cin >> x >> n; ll sum = 0; for (int i = 0; i < n; i++) { int ai; cin >> ai; ll xa = powmod(x, ai); sum = (sum + xa) % MOD; } printf("%lld\n", sum); return 0; }