fullwidthSpaces :: [Integer] -> Integer fullwidthSpaces ws | (not $ all even ws) && (not $ all odd ws) = -1 | otherwise = (`div` 2) $ sum $ map ((-) $ maximum ws) ws main :: IO () main = getLine >> getContents >>= print . fullwidthSpaces . map (\(a : b : _) -> a + 4 * b) . map (map read) . map words . lines