local n = io.read("*n")
local tsum = 0
local t = {}
local vmax = {}
for i = 1, n do
  t[i] = 2 * io.read("*n")
  tsum = tsum + t[i]
end
local mmi, mma = math.min, math.max
for i = 1, tsum do
  vmax[i] = mmi(i / 2, (tsum - i) / 2)
end
local tprev = 0
for i = 1, n do
  local v = io.read("*n")
  for j = 1, tprev - 1 do
    vmax[j] = mmi(vmax[j], v + (tprev - j) / 2)
  end
  for j = mma(1, tprev), tprev + t[i] do
    vmax[j] = mmi(vmax[j], v)
  end
  tprev = tprev + t[i]
  for j = tprev + 1, tsum do
    vmax[j] = mmi(vmax[j], v + (j - tprev) / 2)
  end
end
local dist = vmax[1]
for i = 2, tsum do
  dist = dist + vmax[i] + vmax[i - 1]
end
print(dist / 4)
