#include using namespace std; using ll = long long; const int MOD = 1000003; int main() { int N; ll x; cin >> x >> N; ll ans = 0; for (int i = 0; i < N; i++) { int a; cin >> a; ll ret = 1; ll b = x; while (a) { if (a & 1) (ret *= b) %= MOD; (b *= b) %= MOD; a /= 2; } (ans += ret) %= MOD; } cout << ans << endl; }