#pragma GCC optimize("O3") #include using std::cerr; using std::cin; using std::cout; using std::abs; using std::min; using std::max; using std::swap; using std::map; using std::pair; using std::set; using std::string; using std::vector; using ll = long long; using uint = unsigned int; using pii = pair; using pll = pair; #define ff first #define ss second #define pb emplace_back #define sqr(x) ((x) * (x)) #ifdef LOCAL #define dbg(as...) {\ vector _v; \ std::stringstream _ss(#as);\ string _cur, _loc;\ while (getline(_ss, _cur, ',')) {\ while (count(_cur.begin(), _cur.end(), '(') != count(_cur.begin(), _cur.end(), ')')) {\ getline(_ss, _loc, ',');\ _cur += "," + _loc;\ }\ _v.pb(_cur);\ }\ err(_v.begin(), as);\ } #else #define dbg(as...) #endif template void err(vector::iterator it, T a) { cerr << it->substr((*it)[0] == ' ') << " = " << a << '\n'; } template void err(vector::iterator it, T a, Ts...as) { cerr << it->substr((*it)[0] == ' ') << " = " << a << ", "; err(++it, as...); } struct init { init() { cin.tie(0); std::iostream::sync_with_stdio(0); cout << std::fixed << std::setprecision(10); cerr << std::fixed << std::setprecision(10); using namespace std::chrono; srand(duration_cast(high_resolution_clock::now().time_since_epoch()).count()); } ~init() { cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n"; } } init; #define int ll const ll MOD = 1e9 + 7; inline ll binpow(ll a, ll pw) { ll res = 1; while (pw) { if (pw & 1) { res *= a; res %= MOD; } a *= a; a %= MOD; pw >>= 1; } return res; } inline ll mulmod(ll a, ll b) { return (a * b) % MOD; } inline ll summod(ll a, ll b) { return (a + b) % MOD; } inline ll reverse(ll a) { return binpow(a, MOD - 2); } int koef, b0; struct segment_tree { int n, sh; vector tree; segment_tree() {} segment_tree(const vector & a) { n = a.size(); sh = 1 << 32 - __builtin_clz(n); tree.resize(2 * sh, 0); for (int i = 0; i < n; ++i) tree[sh + i] = mulmod(mulmod(koef, a[i]), binpow(b0, n - i - 1)); for (int i = sh - 1; i > 0; --i) tree[i] = summod(tree[i + i], tree[i + i + 1]); } void update(int i, int val) { val = mulmod(val, mulmod(koef, binpow(b0, n - i - 1))); for (tree[i += sh] = val; i /= 2; ) tree[i] = summod(tree[i + i], tree[i + i + 1]); } int get(int v, int tl, int tr, int l, int r) { if (l > tr || r < tl) return 0; if (l <= tl && tr <= r) return tree[v]; int tm = tl + tr >> 1; return summod(get(v + v, tl, tm, l, r), get(v + v + 1, tm + 1, tr, l, r)); } int get(int l, int r) { return mulmod(get(1, 0, sh - 1, l, r), reverse(binpow(b0, n - r - 1))); } }; const string answer[2] = {"No\n", "Yes\n"}; int32_t main() { int n, q; cin >> n >> koef >> b0 >> q; koef = reverse(koef); b0 = -mulmod(b0, koef); dbg(koef); vector a(n); for (int & i : a) cin >> i; segment_tree s(a); int type, l, r; // while (cin >> l >> r) { // dbg(s.get(l, r)); // } while (q--) { cin >> type >> l >> r; if (type == 1) { s.update(l, r); } else { cout << answer[s.get(l, r) == 0]; } } return 0; }