#include using namespace std; #define ll long long #define ull unsigned long long #define si(X) scanf("%d", &(X)) #define sll(X) scanf("%lld",&(X)) #define INFL 0x3f3f3f3f3f3f3f3fLL ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b); } string toBin(ll a) { string res = ""; while (a) { res += char((a & 1) + '0'); a >>= 1; } reverse(res.begin(), res.end()); return res; } const int mod = 1e9+7; ll expo(ll base,ll pow){ ll ans = 1; while(pow!=0){ if(pow&1==1){ ans = ans*base; ans = ans%mod; } base *= base; base%=mod; pow/=2; } return ans; } ll inv(ll x){ return expo(x,mod-2); } bool isPal(string ss){ int len = ss.length(); for(int i = 0 ; i>n>>a>>b>>q; for(int i = 1 ; i<=n ; i++){ sll(arr[i]); } ll val; while(q--){ int typ , pos , l , r; si(typ); if(typ == 1){ si(pos); sll(val); pos++; arr[pos] = val; } else{ int o = 0; si(l); si(r); l++; r++; ll temp_nex = arr[r]; for(int i = r ; i>l ; i--){ ll quo = temp_nex*inv(a); /* if(temp_nex%a != 0){ o = 1; break; }*/ // ll quo = temp_nex/a; ll val = (b*quo)%mod; temp_nex = (arr[i-1] - val + mod)%mod; // cout<