main = interact $ unlines . map show . sum_and_average . map (map read . splitOn ',') . lines

splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)

sum_and_average sas = [sum_, average_]
 where
  sum_ = sum $ map product sas
  average_ = round $ fromIntegral (sum $ map last sas) / fromIntegral (length sas)