object Main extends App {
  import scala.io.StdIn._
  val Array(n, q, l, r) = readLine.trim.split(' ').map(_.toLong)
  val number = readLine.trim.split(' ').map(_.toLong)
  val queries = Array.fill(q.toInt){
    val Array(q, x, s, t ) = readLine.trim.split(' ').map(_.toLong)
    Query(q, x, s, t)
  }
  var lower = BigInt(l)
  var upper = BigInt(r)
  var range: Range = queries.foldRight(Section(l, r): Range){case (q, r) ⇒ r.reverse(q)}
  println(number.count(range.contains))
  case class Query(q: Long, x: Long, s: Long, t: Long)
  sealed trait Range {
    def contains(value: Long): Boolean
    def contains(value: BigInt): Boolean
    def split(value: BigInt): (Range, Range)
    def takeUntil(value: BigInt): Range
    def takeTo(value: BigInt): Range
    def dropUntil(value: BigInt): Range
    def dropTo(value: BigInt): Range
    def +(that: Range): Range
    def reverse(query: Query): Range
  }
  case object Empty extends Range {
    override def contains(value: Long): Boolean = false
    override def contains(value: BigInt): Boolean = false
    override def split(value: BigInt): (Range, Range) = (Empty, Empty)
    override def takeUntil(value: BigInt): Range = Empty
    override def takeTo(value: BigInt): Range = Empty
    override def dropUntil(value: BigInt): Range = Empty
    override def dropTo(value: BigInt): Range = Empty
    override def +(that: Range): Range = that
    override def reverse(query: Query): Range = Empty
  }
  case class Section(from: BigInt, to: BigInt) extends Range {
    override def contains(value: Long): Boolean = from <= value && value <= to
    override def contains(value: BigInt): Boolean = from <= value && value <= to
    override def split(value: BigInt): (Range, Range) = if (contains(value)) (Section(from, value), Section(value, to)) else if (value < from) (Empty, this) else (this, Empty)
    override def takeUntil(value: BigInt): Range = if (value < from) Empty else Section(from, min(to, value - 1))
    override def takeTo(value: BigInt): Range = if (value < from) Empty else Section(from, min(to, value))
    override def dropUntil(value: BigInt): Range = if (to < value) Empty else Section(max(from, value), to)
    override def dropTo(value: BigInt): Range = if (to < value) Empty else Section(max(from, value + 1), to)
    override def +(that: Range): Range = that match {
      case Empty ⇒ this
      case Section(fromT, toT) ⇒Section(min(fromT, from), max(toT, to))
    }
    override def reverse(query: Query): Range = query match {
      case Query(1, x, s, t) ⇒ takeUntil(x) + Section((from + t - 1) / t - s, to / t - s).dropUntil(x)
      case Query(2, x, s, t) if to < 0 ⇒ Section(from * t + s + 1 - t, to * t + s).takeTo(x) + dropTo(x)
      case Query(2, x, s, t) if contains(0) ⇒ Section(from * t + s + 1 - t, to * t + s + t - 1).takeTo(x) + dropTo(x)
      case Query(2, x, s, t) ⇒ Section(from * t + s, to * t + s + t - 1).takeTo(x) + dropTo(x)
      case _ ⇒ ???
    }
  }
  def min[T: Ordering](a: T, b: T): T = if (implicitly[Ordering[T]].compare(a, b) <= 0) a else b
  def max[T: Ordering](a: T, b: T): T = if (implicitly[Ordering[T]].compare(a, b) >= 0) a else b
}
