#include #include #include using namespace std; typedef long long ll; int main() { int x, N; vector a, memo; cin >> x >> N; a.resize(N); for (auto &p : a) cin >> p; int key = 1; memo.push_back(x); for (int i = 0; key <= 100000000; ++i) { memo.push_back(memo[i] * memo[i] % 1000003); key *= 2; } int ans = 0; for (int i = 0; i < N; ++i) { ll pAns = 1; for (int j = 0; j < memo.size(); ++j) { if (a[i] & 1 << j) pAns = pAns * memo[j] % 1000003; } ans = (ans + pAns) % 1000003; } cout << ans << endl; return 0; }