main = getContents >>= putStr.formatOut.calc.formatIn

formatIn :: String -> [Int]
formatIn = map (read :: String -> Int).words.last.lines

formatOut :: [Int] -> String
formatOut = (++"\n").unwords.map show

calc :: [Int] -> [Int]
calc n = [minimum n, maximum n, sum n]