#include #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 #define int long long using namespace std; typedef long long ll; typedef vector> mat; const int INF = 1e9; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } signed main() { int x, N; int a; const int mod = 1000003; cin >> x >> N; int ans = 0; REP(i,N) { cin >> a; ans += mod_pow(x, a, mod); } cout << ans % mod << endl; }