import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0;
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
    int n = scan!int;
    int[] ts = scan!int(n);
    int[] vs = scan!int(n);

    int[] hs = new int[](ts.sum * 2 + 1);
    hs.fill(100);

    int tsum = 0;
    foreach(int i; 0 .. n){
        int t = ts[i] * 2, v = vs[i] * 2;
        foreach(int k; 0 .. hs.length.to!int){
            if(k < tsum) hs[k].lowerTo(v + tsum - k);
            else if(k < tsum + t) hs[k].lowerTo(v);
            else hs[k].lowerTo(v + k - tsum - t);
        }
        tsum += t;
    }
    foreach(int k; 0 .. hs.length.to!int){
        hs[k].lowerTo(k);
        hs[k].lowerTo(tsum - k);
    }

    real ans = 0.0;
    foreach(k; 0 .. hs.length - 1){
        ans += (hs[k].to!real + hs[k + 1].to!real) / 8.0;
    }
    ans.writeln;

}