import Data.Char

main = interact $ unlines . map (show' . koto_subway) . read' . lines
 where
  read' ("0 0":_) = []
  read' (de:xs) = map read (words de) : read' xs
  show' r = normalize (show r)

koto_subway [d,e] = minimum [abs (distance x y - fromIntegral e) | x<-[0..d], y<-[0..d], x+y==d]
 where distance x y = sqrt (fromIntegral (x^2 + y^2))

normalize xs
 | notElem 'e' xs = xs
 | otherwise = ("0." ++ replicate (read [e] - 1) '0' ++ (filter isDigit ns))
  where (ns,['e','-',e]) = break (=='e') xs