#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n; int a; int b; int q; cin >> n >> a >> b >> q; vector c(n); for(int c_i = 0; c_i < n; c_i++){ cin >> c[c_i]; } for(int a0 = 0; a0 < q; a0++) { int queryType; int first; int second; cin >> queryType >> first >> second; // your code goes here if (queryType == 1) { c[first] = second; // cout << "coef " << first << " got changed to " << second << endl; } else if (queryType == 2) { long long int num = c[second]; long long int denom = 1; for (int i = second -1; i >= first; --i) { num *= -b; denom *= a; // cout << "num: " << num << " denom: " << denom << " after mult" << endl; num += c[i]*denom; // cout << "num: " << num << " denom: " << denom << " after adding " << c[i] << endl; } string answer = (num % 1000000007 == 0) ? "Yes" : "No"; cout << answer << endl; } else { cout << "unknown query type\n"; } } return 0; }