sum = 0
avg = 0.0
count = 0

loop do
  line = gets
  break if line.nil?
  
  price, value = line.chomp.split(',').map(&:to_i)
  sum += price * value
  avg += value
  
  count += 1.0
end

puts sum
puts (avg / count).round