#include using namespace std; #define FOR(i,a,b) for(lli i=(lli)a;i<=(lli)b;i++) #define endl "\n" #define mp make_pair #define X first #define Y second #define inf mod #define mod 1000000007 #define pb push_back #define pi 3.14159265359 #define gc getchar #define Case cout<<"Case #"<<++cas<<": "; #define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long int lli; typedef pair pii; typedef pair pli; typedef vector vii; typedef pair pll; lli r[1000009],A[100009]; lli power(lli a,lli b) { if(b==0) return 1; lli p=power(a,b/2); lli pp=(p*p)%mod; if(b & 1) return (pp*a)%mod; else return pp; } lli inv(lli a) { if(a<=1000000) return (r[a]); if(mod%a<=1000000) return ( mod - (mod/a)*r[mod%a]%mod )%mod; return power(a,mod-2); } int main() { lli n,a,b,q,c,d,sum,l,rr,ind,x,ch; r[1] = 1; for (int i = 2 ; i < 1000005 ; i ++ ) r[i] = ( mod - (mod/i)*r[mod%i]%mod )%mod; cin>>n>>a>>b>>q; d=(b*inv(a))%inf; d=(inf-d)%inf; FOR(i,1,n) cin>>A[i]; while(q--) { cin>>ch; if(ch==1) { cin>>ind>>x; ind++; A[ind]=x; } else { cin>>l>>rr; c=1;sum=0; FOR(i,l+1,rr+1) { sum=(sum+A[i]*c)%inf; c=(c*d)%inf; } //cout<