import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable inf = 10^^9 + 7;

void main() {
    int n;
    int[] t, v;

    scan(n);
    t = readln.split.to!(int[]);
    v = readln.split.to!(int[]);

    t[] *= 2;
    v[] *= 2;
    v ~= 200;

    int T = t.sum();

    auto dp = new int[][](T + 1, 300);
    fillAll(dp, -inf);
    dp[0][0] = 0;

    foreach (i ; 1 .. T + 1) {
        foreach (j ; 0 .. 201) {
            if (j <= (i == t[0] ? min(v[0], v[1]) : v[0])) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j] + 2*j);

                if (j - 1 >= 0) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 2*j - 1);
                }

                if (j + 1 <= 200) {
                    dp[i][j] = max(dp[i][j], dp[i - 1][j + 1] + 2*j + 1);
                }
            }
            else {
                dp[i][j] = -inf;
            }
        }

        if (i == t[0] && i < T) {
            t[1] += t[0];
            t.popFront();
            v.popFront();
        }

        debug {
            writeln(dp[i][0 .. 10]);
        }
    }

    writefln("%.8s", dp[T][0] / 8.0);
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}