#include #include using namespace std; typedef long long ll; static const int MOD=1000003; ll mod_pow(ll x, ll n){ //べき乗 ll ans=1; while(n!=0){ if(n&1) ans=ans*x%MOD; x=x*x%MOD; n=n>>1; } return ans; } int main(){ int x,N; cin >> x >> N; int a[N]; ll ans=0; for(int i=0;i> a[i]; ans+=mod_pow(x,a[i]); } cout << ans << endl; }