import Debug.Trace

main :: IO ()
main = do
  n <- readLn :: IO Int
  ts <- getInts
  vs <- getInts
  let ts' = makets $ map fromIntegral ts 
      vs' = makevs $ map fromIntegral vs
      fs = makeFun ts' vs'
      t = fst $ last ts'
  print $ solve t fs

getInts :: IO [Int]
getInts = map read . words <$> getLine

makevs :: [Float] -> [Float]
makevs vs = 0 : vs ++ [0]

makets :: [Float] -> [(Float, Float)]
makets ts = (0, 0) : (zip ts' $ drop 1 ts' ++ [last ts'])
  where
    ts' = scanl (+) 0 ts

makeFun :: [(Float, Float)] -> [Float] -> [Float -> Float]
makeFun ts vs = zipWith (curry f) ts vs
  where
    f ((l, r), v) x
      | 0 <= x && x <= l = v + (l - x)
      | l <= x && x <= r = v
      | otherwise = v + (x - r)
 
solve :: Float -> [Float -> Float] -> Float
solve t fs = sum $ map f [0, 0.5..t-0.5]
  where
    f t' = --trace (unwords (map show ((app t') : [app (t' + 0.5)]))) $
      area (app t') (app (t' + 0.5))
    app x = minimum $ map (\g -> g x) fs
    area x y = 0.25 * (x + y)

