#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { long long MOD = 1000003, x, N, a[105], ans = 0; cin >> x >> N; for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; i++) { long long cnt = 1; for (int j = 0; j < a[i]; j++) { cnt = cnt * x % MOD; } //cout << "cnr: " << cnt << endl; ans = (ans + cnt) % MOD; } cout << ans << endl; return 0; }