#include using namespace std; typedef unsigned long long ull; ull M = 1000003; ull power(ull x, ull n) { ull tmp = 1; if (n > 0) { if (n % 2 == 0) tmp = power((x*x) % M, n / 2) % M; else tmp = (power((x*x) % M, n / 2) * x) % M; } return tmp; } int main() { int x, n, i; ull a[101], sum = 0; cin >> x >> n; for (i = 1; i <= n; i++) { cin >> a[i]; sum += power(x, a[i]); } cout << sum % M << endl; }