rr = raw_input rrM = lambda: map(int, rr().split()) MOD = 10**9 + 7 N, A, B, Q = rrM() P = rrM() segtree = [0] * (2**18) Apow = [pow(A, 2**z,MOD) for z in xrange(18)] Bpow = [pow(-B, 2**z,MOD) for z in xrange(18)] #print 'apb', Apow,Bpow def powgen(arr, x): ct = 0 ans = 1 while x: if x % 2: ans *= arr[ct] ct += 1 x /= 2 return ans for i,u in enumerate(P): segtree[2**17 + i] = u for size in xrange(17): offset = 2**(17-1-size) for k in xrange(offset): segtree[offset + k] = (Apow[size] * segtree[2*(offset+k)] % MOD + Bpow[size] * segtree[2*(offset+k) + 1]) % MOD def replace(i, value): #replace P[index] with value segtree[2**17 + i] = value for size in xrange(17): offset = 2**(17-1-size) for k in xrange(offset): segtree[offset + k] = (Apow[size] * segtree[2*(offset+k)] % MOD + Bpow[size] * segtree[2*(offset+k) + 1]) % MOD def querycomponent(pos, logsize): start = 2**17 + pos while logsize: start /= 2 logsize -= 1 return segtree[start] def query(L, R): #split into disjoint segments #each seg can go up its 0 ct if L > R: return 0 x = L ct = 0 if x == 0: ct = 17 x == 2**17 else: while x%2 == 0: x /= 2 ct += 1 #can go up to [L, L + 2**ct - 1] while L+2**ct - 1 > R: ct -= 1 tot = R-L+1 size = 2**ct return ( querycomponent(L, ct) * powgen(Apow, tot-size) %MOD + query(L + size, R) * powgen(Bpow, size)%MOD )%MOD for _ in xrange(Q): type_, L, R = rrM() if type_ == 1: replace(L, R) else: #print query(L, R) print "No" if query(L, R) else "Yes"