#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=201000;
int n,q,a[N];
ll L,R,f[N][4];
int main() {
	scanf("%d%d%lld%lld",&n,&q,&L,&R);
	rep(i,0,n) scanf("%d",a+i);
	rep(i,0,q) scanf("%lld%lld%lld%lld",f[i],f[i]+1,f[i]+2,f[i]+3);
	sort(a,a+n);
	int l=-1,r=n;
	while (l+1<r) {
		int md=(l+r)>>1;
		__int128_t p=a[md];
		rep(i,0,q) {
			if (f[i][0]==1) {
				if (p>=f[i][1]) p=(p+f[i][2])*f[i][3];
			} else {
				if (p<=f[i][1]) p=(p-f[i][2])/f[i][3];
			}
		}
		//printf("%d %lld\n",md,(ll)p);
		if (p>=L) r=md; else l=md;
	}
	int x=r;
	l=-1,r=n;
	while (l+1<r) {
		int md=(l+r)>>1;
		__int128_t p=a[md];
		rep(i,0,q) {
			if (f[i][0]==1) {
				if (p>=f[i][1]) p=(p+f[i][2])*f[i][3];
			} else {
				if (p<=f[i][1]) p=(p-f[i][2])/f[i][3];
			}
		}
		//printf("%d %lld\n",md,(ll)p);
		if (p<=R) l=md; else r=md;
	}
	//printf("%d %d\n",l,x);
	printf("%d\n",l-x+1);
}

