#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct Q{
  ll q,x,s,t; 
};
vi A;
vector<Q> query;
ll n,q,l,r;
ll calc(ll num){
  for(int i=0;i<q;i++){
    if(query[i].q==1){
      if(num>=query[i].x){
	num+=query[i].s;
	num*=query[i].t;
      }
    }else{
      if(num<=query[i].x){
	num-=query[i].s;
	num/=query[i].t;
      }
    }
  }
  return num;
}
bool check(ll mid){
  return calc(A[mid])>=l;
}
bool check2(ll mid){
  return calc(A[mid])<=r;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>q>>l>>r;
  A.resize(n);
  for(auto &a:A)cin>>a;
  sort(ALL(A));
  query.resize(q);
  for(auto &a:query){
    cin>>a.q>>a.x>>a.s>>a.t;
  }
  ll le=-1,ri=n-1;
  while(ri-le>1){
    ll mid=(ri+le)/2;
    if(check(mid)){
      ri=mid;
    }else{
      le=mid;
    }
  }
  ll le2=0,ri2=n;
  while(ri2-le2>1){
    ll mid=(ri2+le2)/2;
    if(check2(mid)){
      le2=mid;
    }else{
      ri2=mid;
    }
  }
  cout<<max(0LL,le2-ri+1)<<endl;
  return 0;
}

