import Data.List.Split
import Text.Printf

main = do
    input <- fmap (map (map read.splitOn ",").lines) getContents
    print $ total input
    print $ round'.average $ input
total :: Num a => [[a]] -> a
total = sum.map product

average xs = (fromIntegral.sum.map last $ xs)/ (fromIntegral.length $ xs)

round' :: Double -> Int
round' n
    | x >= 0.5 = ceiling n
    | x <  0.5 = floor n
    where (a,x) = properFraction n