#include using namespace std; #define FOR(i,a,b) for (int i = (a); i <= (b); i++) #define FORD(i,a,b) for (int i = (a); i >= (b); i--) #define REP(i,a) FOR(i,0,(int)(a)-1) #define reset(a,b) memset(a,b,sizeof(a)) #define BUG(x) cout << #x << " = " << x << endl #define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;} #define CON(x) {cout << #x << " = "; for(auto i:x) cout << i << ' '; cout << endl;} #define mod 1000000007 #define pi acos(-1) #define eps 0.00000001 #define pb push_back #define sqr(x) (x) * (x) #define _1 first #define _2 second long long n, a, b, q, t, l, r, lis[100005], bit[500005], deg[100005]; long long expo(long long x, long long y) { long long res = 1; FORD (i, 30, 0) { res *= res; res %= mod; if ((1 << i) & y) { res *= x; res %= mod; } } return res; } long long read(long long x) { long long res = 0; while (x > 0) { res += bit[x]; x -= x & (-x); } return res % mod; } void write(long long x, long long val) { while (x < 300000) { bit[x] += val; bit[x] %= mod; x += x & (-x); } } int main() { ios::sync_with_stdio(false); cin >> n >> a >> b >> q; if (b == 0) { FOR (i, 1, n) cin >> lis[i]; while (q--) { cin >> t >> l >> r; if (t == 1) { lis[l + 1] = r; } else { if (lis[1]) cout << "NO" << endl; else cout << "YES" << endl; } } return 0; } b *= -expo(a, mod - 2); long long cur = 1; FOR (i, 0, n) { deg[i] = cur; cur = (cur * b) % mod; } FOR (i, 1, n) { cin >> lis[i]; write(i, lis[i] * deg[i]); } while (q--) { // BUG(q); cin >> t >> l >> r; // cout << t << l << r << endl; if (t == 1) { l++; write(l, deg[l] * (r - lis[l])); lis[l] = r; } else { long long cur = read(r + 1) - read(l); if (cur % mod) cout << "NO" << endl; else cout << "YES" << endl; } } }