import Data.List
main = interact $ show.solve.(map read).words
solve (a:b:[]) = intersectMin [rev 8 a..rev 8 (a+1)] [rev 10 b..rev 10 (b+1)]
rev::Int->Int->Int
rev t a = b t a (-1) (10^6)
intersectMin::[Int]->[Int]->Int
intersectMin as bs = head $ sort [a | a<-as, b<-bs, a==b]++[-1]
b t a l r
    | l+1==r = r
    | z t a m = b t a l m
    | otherwise = b t a m r
    where m = div (l+r) 2
z t a x = (flip div 100 $ t*x) >= a