#include #include #include #include #include #include #include #include #include #include using namespace std; long long const MOD = 1000000007; long long inverse(long long x) { static unordered_map d; assert(x > 0); if(d.count(x) > 0) return d[x]; long long t = 0; long long newt = 1; long long r = MOD; long long newr = x; while(newr != 0) { long long q = r / newr; long long temp = newt; newt = t - q * newt; t = temp; temp = newr; newr = r - q * newr; r = temp; } d[x] = (MOD + t) % MOD; return d[x]; } bool is_divisible(vector r, vector const& b) { assert(b.back() > 0); while(r.back() == 0) r.pop_back(); // vector q(r.size(), 0); int const degree = static_cast(b.size())-1; int rd = static_cast(r.size())-1; while(rd >= degree) { long long const s = (r.back() * inverse(b.back())) % MOD; long long const x = rd - degree; assert(x >= 0); // cout << s << " " << x << endl; for(int i=0; i(r.size())-1; } return r.empty(); } int main() { int n, q; long long a,b; cin >> n >> a >> b >> q; vector c(n); vector Q = {b,a}; for(auto& ci : c) cin >> ci; while(q--) { int x,y,z; cin >> x >> y >> z; if(x == 1) { c[y] = z; } else { if(is_divisible(vector(c.begin() + y, c.begin() + z + 1), Q)) cout << "Yes" << endl; else cout << "No" << endl; } } return 0; }