N = gets.to_i

as = []
asa = []
bs = 0

def calc(as, bs, x)
  r = 0
  as.each do |d|
    r += (x - d).abs
  end
  r += bs
  r
end

N.times do
  q, a, b = gets.split.map(&:to_i)
  if q == 1
    as << a
    asa << a.abs
    bs += b
  end

  if q == 2
    r1 = as[asa.index(asa.min)]
    r2 = calc(as, bs, r1)
    puts "#{r1} #{r2}"
  end
end