#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ ll x, n, ans = 0, mod = 1000003; cin >> x >> n; for (int i = 0; i < n; i++){ int a, x1; cin >> a; x1 = 1; while (a){ x1 *= x; x1 %= mod; a--; } ans += x1; ans %= mod; } cout << ans << endl; }