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 = [0] ~ v;

    auto ts = new int[](n + 1);
    foreach (i ; 1 .. n + 1) {
        ts[i] = ts[i - 1] + t[i - 1];
    }

    int f(int i, int x) {
        if (i == 0) return x;
        if (i == n + 1) return -x + ts[n];

        if (x <= ts[i - 1]) {
            return -x + ts[i - 1] +v[i]; 
        }
        else if (x <= ts[i]) {
            return v[i];
        }
        else {
            return x - ts[i] + v[i];
        }
    }

    int h, ans;

    foreach (ti ; 1 .. ts[n] + 1) {
        int hn = 10000;

        foreach (i ; 0 .. n + 2) {
            hn = min(hn, f(i, ti));
        }

        ans += h + hn;
        h = hn;
    }

    writefln("%.8s", ans / 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);
        }
    }
}