program atcoder_express
  implicit none
  integer :: n, i
  real(8) :: t(100), v(0:101), l(0:101), r(0:101)
  real(8) :: x, f0, f1, s, ds
  character(32) :: a
  t = 0.d0
  v = 0.d0
  l = 0.d0
  r = 0.d0
  read(*,*) n
  read(*,*) t(1:n)
  read(*,*) v(1:n)
  do i = 1, n
    l(i) = r(i-1)
    r(i) = l(i) + t(i)
  end do
  l(n+1) = r(n)
  r(n+1) = l(n+1)
  x = 0.d0
  f0 = 0.d0
  s = 0.d0
  ds = 0.5d0
  do
    f1 = f(s+ds,n,l(0:n+1),r(0:n+1),v(0:n+1))
    x = x + 0.5d0*(f0+f1)*ds
    f0 = f1
    s = s + ds
    if (s.ge.r(n+1)) exit
  end do
  write(a,'(f22.10)') x
  write(*,'(a)') trim(adjustl(a))
  stop
contains
  function f(t,n,l,r,v) result(u)
    implicit none
    integer, intent(in) :: n
    real(8), intent(in) :: t, l(0:n+1), r(0:n+1), v(0:n+1)
    integer :: i
    real(8) :: u, w
    u = 1.e20
    do i = 0, n+1
      w = v(i) + max(l(i)-t,0.d0) + max(t-r(i),0.d0)
      if (u.gt.w) u = w
    end do
  end function f
end program atcoder_express