module Main (main) where

main :: IO ()
main = getLine >> solve 0 0 0 <$> (map ((\[x,y] -> (x,y)) . map read . words) . lines <$> getContents) >>= putStrLn

solve :: Int -> Double -> Double -> [(Double, Double)] -> String
solve cnt total pos ss | cnt < length ss = if uncurry (flip (/)) sushi > 1.0
                                            then solve (cnt + 1) (sEne + pos + total - sDist) (fst sushi + pos) ss
                                            else solve (cnt + 1) total pos ss
                       | otherwise       = show $ floor total
          where sushi@(sDist, sEne) = ss !! cnt
