#include #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } ll MOD = 1000003; ll powmod(ll a, ll b){ if(b == 0) return 1; if(b & 1) { return a * powmod(a, b - 1) % MOD; } else { ll d = powmod(a, b / 2) % MOD; return d * d % MOD; } } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll x, n; cin >> x >> n; ll ans = 0; rep(i, n){ ll a; cin >> a; ans += powmod(x, a); ans %= MOD; } cout << ans << endl; }