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

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str) { return str.split.to!(T[]); }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

void main()
{
	auto N = RD!long;
	auto t = 0 ~ RDR.split.to!(long[]) ~ 0;
	auto v = 0 ~ RDR.split.to!(double[]) ~ 0;
	
	double ans = 0.0;
	foreach (i; 1..N+1)
	{
		auto diff1 = v[i] > v[i-1] ? cast(double)abs(v[i] - v[i-1]) : 0.0;
		auto diff2 = v[i] > v[i+1] ? cast(double)abs(v[i+1] - v[i]) : 0.0;
		auto mid   = t[i] - diff1 - diff2;
		if (mid < 0)
		{
			auto diff3 = v[i-1] - v[i+1];
			auto top = (t[i] + abs(diff3)) / 2.0 - max(0, diff3);
			diff1 = top;
			diff2 = t[i] - top;
			v[i]  = v[i-1] + top;
			mid = 0;
		}
		ans += v[i-1] * diff1 + pow(diff1, 2) / 2;
		ans += v[i+1] * diff2 + pow(diff2, 2) / 2;
		ans += v[i] * mid;
		stderr.writeln(ans);
	}

	writeln(ans);
	stdout.flush();
}