cin >> n >> k >> m; for (int i = 1; i <= k; ++i) cin >> a[i], d[i] = a[i] - a[i - 1]; ll sum = pow_mod(m, n), ans = sum; for (int i = 1; i <= k; ++i) { ll t = pow_mod(m, d[i]), invt = pow_mod(t, p - 2); ans = (ans + sum * invt) % p; sum = sum * (invt + 1) % p; } cout << ans * pow_mod(pow_mod(2, k), p - 2) % p << "\n"; return0; }