#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=1444999999; ll mod=1000000007; ll modpow(ll x, ll n) { x = x%mod; if(n==0) return 1; //再帰の終了条件 else if(n%2==1) { return (x*modpow(x, n-1))%mod; //nが奇数ならnを1ずらす } else return modpow((x*x)%mod, n/2)%mod; //nが偶数ならnが半分になる } int main(){ ll n,m,k,p,q; cin >> n >> m >> k >> p >> q; vectorc(n); for (ll i = 0; i < n; i++) { cin >> c[i]; } ll a=p; ll b=q-p; ll x=modpow((a+b)%mod,k); ll y=modpow((a-b+mod)%mod,k); ll ans=0; ll qq=modpow(q,k); qq=inv_mod(qq,mod); for (ll i = 0; i < m; i++) { ll xx=x+y; xx%=mod; xx*=qq; xx%=mod; xx*=inv_mod(2,mod); xx%=mod; xx*=c[i]; xx%=mod; ans+=xx; ans%=mod; } for (ll i = m; i < n; i++) { ll xx=x-y+mod; xx%=mod; xx*=qq; xx%=mod; xx*=inv_mod(2,mod); xx%=mod; xx*=c[i]; xx%=mod; ans+=xx; ans%=mod; } cout << ans << endl; }