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

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!T;r.popFront;}}

const inf = 10^^9;

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

  t[] *= 2; v[] *= 2;
  foreach (i; 0..n-1) t[i+1] += t[i];
  auto te = t[$-1];

  auto l = [Line(1, 0, 0, te), Line(-1, te, 0, te)];

  foreach (i; 0..n)
    l ~= Line(0, v[i], i == 0 ? 0 : t[i-1], t[i]);

  foreach (i; 0..n-1)
    if (v[i] < v[i+1])
      l ~= Line(1, v[i]-t[i], t[i], te);
    else
      l ~= Line(-1, v[i+1]+t[i], 0, t[i]);

  auto u = new int[](te+1);
  foreach (i; 0..te+1)
    u[i] = l.map!(li => li.v(i)).reduce!min;

  auto r = 0.0L;
  foreach (i; 0..te)
    if      (u[i] < u[i+1]) r += 0.5 + u[i];
    else if (u[i] > u[i+1]) r += 0.5 + u[i+1];
    else                    r += u[i];

  writefln("%.4f", r/4);
}

struct Line
{
  int a, b, ts, te;
  auto v(int t) { return (t < ts || t > te) ? inf : a*t+b; }
}
