#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD 1000003 #define INF 100000000 using namespace std; typedef long long LL; typedef vector VI; typedef pair PI; LL modp(LL a, LL b) { if (b == 0) return 1; if (b == 1) return a; if (b % 2 == 1) return (a * modp(a, b - 1)) % MOD; return (modp(a, b / 2) * modp(a, b / 2)) % MOD; } int main() { int x, n; cin >> x >> n; LL ans = 0; REP(i, n) { int a; cin >> a; ans += modp(x, a); } cout << ans % MOD << endl; return 0; }