import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (a : b : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    a' = 100 * a
    b' = 100 * b
    cs = filter p [1..1000]
      where
        p :: Int -> Bool
        p k = a' <= 8 * k && 8 * k < a' + 100 && b' <= 10 * k && 10 * k < b' + 100
  print $ if null cs then -1 else head cs

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
