#include using namespace std; typedef long long ll; #define REP(i,f,l) for(int i=f;i> x >> n; x %= devider; table[0] = 1; REP(i,1,devider) { table[i] = (table[i-1]*x) % devider; } int sum = 0; int val; int count = 0; REP(i,0,n){ cin >> val; count++; //1000003は素数なのでフェルマーの小定理を利用する sum += table[val%(devider-1)]; } cout<