object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val n = readLine.trim.toInt
  val Array(a, d) = readLine.trim.split(' ').map(_.toInt)
  val m = readLine.trim.toInt
  val orders = Array.tabulate(m){_⇒
    val Array(x, y, z) = readLine.trim.split(' ').map(_.toInt)
    (x, y, z)
  }
  var k = readLine.trim.toInt
  for ((_, y, z) ← orders.filter(_._1 == 0).reverse) {
    k = reverse(y to z, k)
  }
  var value = a + d * (k - 1)
  for ((x, y, z) ← orders){
    if ((y to z).contains(k)) {
      x match {
        case 0 ⇒ k = reverse(y to z, k)
        case 1 ⇒ value += 1
        case 2 ⇒ value /= 2
        case _ ⇒ ???
      }
    }
  }
  println(value)
  def reverse(range: Range, k: Int): Int = {
    if (range.contains(k)){
      range.last - (k - range.head)
    }else k
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
