price_sum = 0
num_sum = 0
line_num = 0

while line = gets
  price, num = line.split(",").map(&:to_i)
  price_sum += price * num
  num_sum += num
  line_num += 1
end

puts price_sum
puts (num_sum.to_f / line_num.to_f).round