main :: IO ()
main = do ls <- getContents
          putStrLn (compose ls)

compose :: String -> String
compose = unwords . fmap show . mathOp . (\xs -> take (head xs) (tail xs)) . (=<<) (fmap (\x -> read x::Int) . words) . lines

mathOp  :: [Int] -> [Int]
mathOp  xs = fmap ($ xs) [mini, maxi, sumi]

mini :: [Int] -> Int
mini [] = error "Empty list was given"
mini [x] = x
mini (x:xs) = min x (mini xs)

maxi :: [Int] -> Int
maxi [] = error "Empty list was given"
maxi [x] = x
maxi (x:xs) = max x (maxi xs)

sumi :: [Int] -> Int
sumi = foldr (+) 0