f a b n
    | n8 > a || n10 > b = -1
    | n8 == a && n10 == b = n
    | otherwise = f a b (n + 1)
  where n8 = n * 8 `div` 100
        n10 = n * 10 `div` 100

main = do
    [a, b] <- map read . words <$> getLine :: IO [Int]
    print $ f a b 1
