a_list = []
a_sum = 0
b_sum = 0
i = 0
1.upto(gets.chomp.to_i) do 
  query = gets.chomp.split(' ').map(&:to_i)
  if query[0] == 1
    a_list.append(query[1])
    a_list.sort!
    b_sum += query[2]
    i += 1
  else
    x = a_list.reduce(-i) do |v, i|
      v += 2
      break i if v >= 0
      v
    end
    fx = a_list.sum{ |an| (x - an).abs } + b_sum
    puts "#{x} #{fx}" 
  end
end
