let () = Scanf.scanf "%d\n" @@ fun n ->
  let ts = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun t -> t in
  let vs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun v -> v in
  let acc = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    acc.(i + 1) <- acc.(i) + ts.(i)
  done;
  let dp = Array.make (1 + 2 * acc.(n)) max_int in
  for i = 0 to n - 1 do
    for j = 2 * acc.(i) to 2 * acc.(i + 1) do
      dp.(j) <- min dp.(j) (2 * vs.(i))
    done;
  done;
  dp.(0) <- 0;
  dp.(2 * acc.(n)) <- 0;
  for i = 1 to 2 * acc.(n) do
    dp.(i) <- min dp.(i) (dp.(i - 1) + 1)
  done;
  for i = 2 * acc.(n) - 1 downto 0 do
    dp.(i) <- min dp.(i) (dp.(i + 1) + 1)
  done;
  Printf.printf "%f\n" @@ ( *. ) 0.25 @@ float_of_int @@ Array.fold_left ( + ) 0 dp