#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; ll tempmod = 1000003; ll modpow(ll n,ll p) { if (p == 0)return 1; if (p % 2 == 0)return (modpow(n,p/2)*modpow(n,p/2))%tempmod; else return (n * modpow(n, p - 1))%tempmod; } int main() { ll x,n; cin >> x >> n; ll ans = 0; rep(i, 0, n) { ll temp; cin >> temp; ans += modpow(x, temp); ans %= tempmod; } cout << ans << endl; return 0; }