#include using namespace std; #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } #define REP(i, a) for(int i = 0; i < a; i++) #define scan(x) cin >> x #define print(x) cout << x << "\n" typedef long long ll; const int d = 1000003; int powmod(ll x, int k) { if (k == 0) return 1; if (k%2 == 0) return powmod(x*x % d, k/2); else return x * powmod(x, k-1) % d; } int main() { fastcin; int x, N; cin >> x >> N; ll a, ans = 0; REP(i, N) { scan(a); ans += powmod(x, a); } print(ans%d); return 0; }