    #include <bits/stdc++.h>
using namespace std;
using Int = long long;

struct Query {
	Int q, x, s, t;
	Query(){}
};

int main() {
	Int n, q, l, r;
	cin >> n >> q >> l >> r;
	vector<Int> a(n);
	for(auto& x : a) cin >> x;
	sort(a.begin(), a.end());

	vector<Query> query(q);
	for(auto& x : query) {
		cin >> x.q >> x.x >> x.s >> x.t;
	}

	auto sim = [&](Int a) {
		for(auto& x : query) {
			if (x.q == 1) {
				if (a < x.x) continue;
				a += x.s;
				a *= x.t;
			} else {
				if (a > x.x) continue;
				a -= x.s;
				bool neg = (a < 0);
				a = abs(a);
				a /= x.t;
				if (neg) a = -a;
			}
		}
		return a;
	};

	Int lx, rx;
	// finally no less than l (max),
	//     and no more than r (min)
	{
		Int ok = n, ng = -1;
		while (ok - ng > 1) {
			Int mid = (ok + ng) / 2;
			(sim(a[mid]) >= l ? ok : ng) = mid;
		}
		lx = ok;
	}
	if (lx == n) {
		cout << 0 << endl;
		return 0;
	}

	{
		Int ok = -1, ng = n;
		while (ng - ok > 1) {
			Int mid = (ok + ng) / 2;
			(sim(a[mid]) <= r ? ok : ng) = mid;
		}
		rx = ok;
	}
	if (rx == -1) {
		cout << 0 << endl;
		return 0;
	}

	cout << rx - lx + 1 << endl;
	return 0;
}

