arr = []
cur = 0

STDIN.gets.to_i.times do
  q = STDIN.gets.split
  case q[0]
  when '0' then
    arr.insert(cur, q[1].to_i)
  when '1' then
    cur += q[1].to_i
  when '2' then
    arr.delete_at(cur)
  end
end

puts arr
