#include int main(void) { long long int x, n; long long int a[101]; long long int i, j; long long int total = 0; long long int subtotal, an; scanf("%lld%lld", &x, &n); for(i = 1;i <= n;i++){ scanf("%lld", &a[i]); } for(i = 1;i <= n;i++){ subtotal= 1; an = x; while(a[i] != 0){ //printf("a[%lld] = %lld %lld\n", i, a[i], an); if(a[i] % 2 == 1){ subtotal = (subtotal * an) % 1000003; } //for(j = 0;j < a[i];j++){ an = (an * an) % 1000003; a[i] /= 2; } //printf("subtotal = %lld\n", subtotal); total = (total + subtotal) % 1000003; } //printf("total = %lld\n", total % 1000003); printf("%lld\n", total); return 0; }