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
stack = []
until ops.empty?
    x, y, z = ops.pop
    next unless (y..z).include?(k)
    if x == 0
        k = z - (k - y)
    elsif x == 1
        stack << 1
    else
        stack << 2
    end
end
x = a + (k - 1) * d
until stack.empty?
    if stack.pop == 1
        x += 1
    else
        x /= 2
    end
end
p x
