package main import ( "fmt" "math/big" ) func main() { var N int var x, a int64 fmt.Scan(&x, &N) X := big.NewInt(x) ans := big.NewInt(0) mod := big.NewInt(1000003) tmp := big.NewInt(0) for i := 0; i < N; i++ { fmt.Scan(&a) A := big.NewInt(a) ans = ans.Add(ans, tmp.Exp(X, A, mod)) } fmt.Println(ans) }