n = io.read('*n')
t, v = {}, {}

for i = 1, n do t[i] = io.read('*n') * 2 end
for i = 1, n do v[i] = io.read('*n') end

t[0] = 0
tot = 0
for i = 1, n do
    tot = tot + t[i]
    t[i] = t[i] + t[i - 1]
end

min, max = {}, {}
for i = 0, tot do min[i], max[i] = 0, math.min(i / 2, (tot - i) / 2) end

for i = 1, n do
    for j = t[i - 1], t[i] do max[j] = math.min(max[j], v[i]) end
    for j = 0, t[i - 1] - 1 do
        min[j] = math.max(min[j], v[i] - 0.5 * (t[i - 1] - j))
        max[j] = math.min(max[j], v[i] + 0.5 * (t[i - 1] - j))
    end
    for j = t[i], tot do
        min[j] = math.max(min[j], v[i] - 0.5 * (j - t[i]))
        max[j] = math.min(max[j], v[i] + 0.5 * (j - t[i]))
    end
end

--for i = 0, tot do print(i / 2, min[i], max[i]) end

ans = 0.0
for i = 0, tot - 1 do ans = ans + (max[i] + max[i + 1]) / 2 end
print(ans / 2)
