import
    std.algorithm,
    std.array,
    std.conv,
    std.range,
    std.stdio,
    std.string;

void main()
{
    immutable n = readln.chomp.to!size_t;
    auto t = readln.chomp.split.map!(to!int).array;
    auto v = readln.chomp.split.map!(to!int).array;
    stderr.writeln("n = ", n);
    stderr.writeln("t = ", t);
    stderr.writeln("v = ", v);

    auto end = t.sum;
    real result = 0;
    foreach (x2; 0..end*2)
    {
        real x = x2 * 0.5;
        real xnext = x + 0.5;
        result += (velocity(x, t, v, end) + velocity(xnext, t, v, end)) / 4;
    }
    result.writeln;
}

auto velocity(real x, int[] t, int[] v, int end)
{
    return t.length.iota.map!(i => limit(i, x, t, v)).reduce!min
        .min(x).min(end-x);
}

auto limit(size_t i, real x, int[] t, int[] v)
{
    int pos;
    int[] start, end;
    foreach (ts; t)
    {
        start ~= pos;
        pos += ts;
        end ~= pos;
    }
    stderr.writeln("start = ", start);
    stderr.writeln("end = ", end);

    if (x < start[i])
    {
        return v[i] + (start[i] - x);
    }
    if (end[i] < x)
    {
        return v[i] + (x - end[i]);
    }
    return v[i];
}
