let round x =
  int_of_float (floor (0.5 +. x))

let _ =
  let s = ref 0
  and n = ref 0
  and c = ref 0 in
  try
    while true do
      let x, y = Scanf.scanf "%d,%d\n" (fun x y -> (x, y)) in
      incr c;
      s := !s + x * y;
      n := !n + y
    done
  with
    End_of_file ->
    Printf.printf "%d\n" !s;
    Printf.printf "%d\n" (round ((float_of_int !n) /. (float_of_int !c)))