#include using namespace std; typedef long long ll; const ll kMOD = 1000 * 1000 + 3; const int kMAX_N = 110; int x, N; int a[kMAX_N]; ll ModPow(ll a, ll n, ll mod) { if (n == 0) return 1; if (n % 2 == 0) { ll temp = ModPow(a, n / 2, mod); return (temp * temp) % mod; } else { return (ModPow(a, n - 1, mod) * a) % mod; } } void Solve() { ll answer = 0; for (int i = 0; i < N; i++) { answer = (answer + ModPow(x, a[i], kMOD)) % kMOD; } cout << answer << endl; } int main() { cin >> x >> N; for (int i = 0; i < N; i++) { cin >> a[i]; } Solve(); return 0; }