import Control.Applicative
import Data.List

main :: IO ()
main = solve <$> f >>= print
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> Int
solve [a, b] = maybe (-1) id . find f $ [1 .. 1009]
  where
    f x = x * 8 `div` 100 == a && x `div` 10 == b
