total = []
average = []
while tmp = gets
  break if tmp == nil
  p tmp = gets.chomp.split(",").map(&:to_i)
  # puts tmp.split(",").map(&:to_i)
  total << tmp[0] * tmp[1]
  average << tmp[1]
end


puts total.inject(:+)
puts (average.inject(:+)/average.size).round
