n = gets.to_i
a, d = gets.split.map(&:to_i)
m = gets.to_i
ops = (1..m).map { gets.split.map(&:to_i) }
k = gets.to_i
s = "%s"
until ops.empty?
    x, y, z = ops.pop
    next unless (y..z).include?(k)
    if x == 0
        k = z - (k - y)
    elsif x == 1
        s.sub!('%s', '(%s + 1)')
    else
        s.sub!('%s', '(%s / 2)')
    end
end
p eval sprintf(s, (a + (k - 1) * d).to_s)
