{-# LANGUAGE OverloadedStrings #-}
import Data.Char
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  [a,b] <- parseLine <$> BS.getLine
  BS.putStrLn . BS.pack . show $ solve a b
  where
     parseLine = unfoldr (BS.readInt . BS.dropWhile isSpace)

solve :: Int -> Int -> Int
solve a b
  | null candidates = -1
  | otherwise = head candidates
  where
    makeCandidates x rate = takeWhile ((==x).floor.(*rate).fromIntegral) [(ceiling ((fromIntegral x)/rate))..]
    candidatesA = makeCandidates a 0.08
    candidatesB = makeCandidates b 0.1
    candidates = intersect candidatesA candidatesB