int n, k, a[N], b[N], cnt[N]; ll fac[N], dp[N][N], f[N], g[N];
ll qpow(ll a, int b) { ll res = 1; while(b) { if(b & 1) res = res * a % mod; a = a * a % mod, b >>= 1; } return res; } ll add(ll x){return x < mod ? x : x - mod;} ll inv(ll x){returnqpow(x, mod - 2);} ll C(int n, int m){return n < m ? 0 : fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod;}
#include<bits/stdc++.h> #define ll long long #define db double #define gc getchar #define pc putchar
usingnamespace std;
namespace IO { template <typename T> voidread(T &x) { x = 0; bool f = 0; char c = gc(); while(!isdigit(c)) f |= c == '-', c = gc(); while(isdigit(c)) x = x * 10 + c - '0', c = gc(); if(f) x = -x; }
constint MAXN = 1e7 + 5; constint N = 1e5 + 5; constint mod = 1004535809; constint G = 3; constint Gi = 334845270;
ll add(ll x){return x < mod ? x : x - mod;} ll sub(ll x){return x < 0 ? x + mod : x;} ll qpow(ll a, int b) { ll res = 1; while(b) { if(b & 1) res = res * a % mod; a = a * a % mod, b >>= 1; } return res; } ll inv(ll x){returnqpow(x, mod - 2);}
ll fac[MAXN], f[N << 2], g[N << 2];
ll C(int n, int m) { return n < m ? 0 : fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod; }
voidNTT(ll *a, int lim, int type) { for(int i = 0; i < lim; i++) if(i < rev[i]) swap(a[i], a[rev[i]]); for(int mid = 1; mid < lim; mid <<= 1) { ll wn = qpow(type == 1 ? G : Gi, (mod - 1) / (mid << 1)); for(int i = 0; i < lim; i += (mid << 1)) { ll w = 1; for(int j = 0; j < mid; j++, w = w * wn % mod) { ll x = a[i + j], y = w * a[i + mid + j] % mod; a[i + j] = add(x + y); a[i + mid + j] = sub(x - y); } } } if(type == -1) { ll limi = qpow(lim, mod - 2); for(int i = 0; i < lim; i++) a[i] = a[i] * limi % mod; } return; }
intmain() { int n, m, s; read(n), read(m), read(s); int cnt = min(m, n / s) + 1; fac[0] = 1; for(int i = 1; i < MAXN; i++) fac[i] = fac[i - 1] * i % mod; for(int i = 0; i < cnt; i++) { f[i] = fac[i] * C(m, i) % mod * fac[n] % mod * inv(qpow(fac[s], i)) % mod * inv(fac[n - s * i]) % mod * qpow(m - i, n - s * i) % mod; g[i] = (i & 1) ? mod - inv(fac[i]) : inv(fac[i]); }
reverse(f, f + cnt); int lim = calclim(cnt << 1); calcrev(lim); NTT(f, lim, 1), NTT(g, lim, 1); for(int i = 0; i < lim; i++) f[i] = f[i] * g[i] % mod; NTT(f, lim, -1); reverse(f, f + cnt); ll ans = 0; for(int i = 0, w; i < cnt; i++) read(w), ans = add(ans + inv(fac[i]) * f[i] % mod * w % mod); write(ans), pc('\n');