#include<bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

ll readint(){
	ll x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const ll inf=(1ull<<63)-1;
ll n,q,l,r;
ll a[200005],opt[200005],X[200005],S[200005],T[200005];

int main(){
	n=readint(); q=readint(); l=readint(); r=readint();
	for(int i=1;i<=n;i++) a[i]=readint();
	for(int i=1;i<=q;i++){
		opt[i]=readint(); X[i]=readint(); S[i]=readint(); T[i]=readint();
	}
	for(int i=q;i>=1;i--){
		ll s=S[i],t=T[i],x=X[i];
		if(opt[i]==1){
			ll tl=l/t-s,tr=r/t-s;
			if(l>x) l=max(tl,x),r=max(tr,x-1);
			else if(r<x);
			else r=max(tr,x-1);
		}
		else{
			ll tl,tr;
			if(l<0){
				if(-inf/(l-1)<=t) tl=-inf;
				else tl=t*(l-1)+s+1;
			}
			else{
				if((inf-s)/l<=t) tl=inf;
				else tl=t*l+s;
			}
			if(r<0){
				if(-inf/r<=t) tr=-inf;
				else tr=t*r+s;
			}
			else{
				if((inf-s+1)/(r+1)<=t) tr=inf;
				else tr=t*(r+1)+s-1;
			}
			if(l>x);
			else if(r<x) l=min(tl,x+1),r=min(tr,x);
			else l=min(tl,x+1);
		}
//		cout<<"test "<<i<<' '<<l<<' '<<r<<endl;
		if(l>r) return printf("0\n"),0;
	}
	int cnt=0;
//	cout<<"end "<<l<<' '<<r<<endl;
//	for(int i=1;i<=n;i++) cout<<a[i]<<' ';
//	cout<<endl;
	for(int i=1;i<=n;i++) if(l<=a[i]&&a[i]<=r) cnt++;
	printf("%d\n",cnt);
	return 0;
}
