import Data.Char main = getLine >>= print . solve . words . foldr ff "" where ff x acc | isDigit x = x : acc | x == '-' = ' ' : x : acc | otherwise = ' ' : acc solve :: [String] -> Int solve (x : xs) | read sy < 0 = ((read $ drop 2 sy ++ x) :: Int) + foldl ff 0 ys + ((read $ take 2 sy) :: Int) | otherwise = ((read $ tail sy ++ x) :: Int) + foldl ff 0 ys + ((read [head sy]) :: Int) where (ys, y) = splitAt (length xs - 1) xs sy = head y ff acc z = read z + acc