process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var n;
    var t;
    var v;
    var i;
    var j;
    var l;
    var r;
    var x;
    var minV;
    var distance;

    n = parseInt(input[0], 10);
    tvals = input[1].split(' ');
    vvals = input[2].split(' ');

    v = new Array(n + 2);
    l = new Array(n + 2);
    r = new Array(n + 2);

    v[0] = 0;
    l[0] = 0;
    r[0] = 0;

    for (i = 0; i < n; i++) {
        t = parseInt(tvals[i], 10);
        v[i + 1] = parseInt(vvals[i], 10);

        l[i + 1] = r[i];
        r[i + 1] = l[i + 1] + t;
    }

    v[n + 1] = 0;
    l[n + 1] = r[n];
    r[n + 1] = r[n];

    minV = new Array(r[n + 1] * 2 + 1);
    for (i = 0; i < r[n + 1] * 2 + 1; i++) {
        minV[i] = 100;
        x = i * 0.5;
        for (j = 0; j < n + 2; j++) {
            minV[i] = Math.min(minV[i], f(x, l[j], r[j], v[j]));
        }
    }

    distance = 0;
    for (i = 0; i < r[n + 1] * 2; i++) {
        distance += (minV[i] + minV[i + 1]) * 0.25;
    }

    console.log(distance);

    return 0;
}

function f(x, l, r, v) {

    if (x < l) {
        return -x + v + l;
    }
    else if (x > r) {
        return x + v - r;
    }
    else {
        return v;
    }
}
