import Control.Applicative main = do a <- readLn print $ maybe $ foldl1 func $ map (func2 a) [8..100] where Nothing `func` Nothing = Nothing Nothing `func` (Just x) = Just x (Just x) `func` _ = Just x func2 a x | (x + 7) == a = Just x | otherwise = Nothing maybe (Just x) = x maybe Nothing = -1