#include #include #define FORR(i,b,e) for(int i=(b);i<(int)(e);++i) #define FOR(i,e) FORR(i,0,e) #define dump(var) cerr << #var ": " << var << "\n" #define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n" typedef long long ll; typedef unsigned long long ull; const ll MODD = 1000003; using namespace std; ll x, N; vector pp; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> x >> N; pp.reserve(100); pp.push_back(x); ll v = x*x; int ex = 1; pp.push_back(v); while (ex < 100000000) { v = (v * v) % MODD; ex *= 2; pp.push_back(v); } ll ans = 0; FOR(i, N) { int a; cin >> a; ll v = 1; auto p = pp.begin(); while (a) { if (a&1) v = (v * (*p)) % MODD; a >>= 1; p++; } ans = (ans + v) % MODD; } cout << ans << endl; return 0; }