#include using namespace std; int power(int x, int a) { if (a == 0) return 1; if (a % 2 == 0) { return power(x * x % 1000003, a / 2); } else { return power(x * x % 1000003, a / 2) * x % 1000003; } } int main() { int x, n, s; cin >> x >> n; for (int i = 0; i < n; i++) { int a; cin >> a; s += power(x, a); } cout << s % 1000003 << endl; }