#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c0){ if(b%2) ret *= num; num = num * num; b /= 2; } }else{ while(b>0){ if(b%2) ret = (ret*num)%p; num = (num*num)%p; b /= 2; } } return ret; } int main(int argc, char const *argv[]) { ll x, n;std::cin >> x >> n; ll ans = 0; ll P = 1000003; re(i, n){ ll t;std::cin >> t; ans = (ans + mpow(x, t, P))%P; } std::cout << ans << '\n'; return 0; }