import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto t = readln.split.to!(int[]);
  auto v = readln.split.to!(int[]);

  ++n;
  t ~= 1;
  v ~= 0;

  foreach (i; 0..n) {
    t[i] *= 2;
    v[i] *= 2;
  }

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

  auto k = new int[](n);
  foreach (i; 0..n) k[i] = v[i] + s[i];

  auto ans = real(0), u = 0, j = 0;
  foreach (i; 0..s[$-2]) {
    if (k[j+1..$].reduce!min < (i+1)+u) {
      ans += u - real(1)/2;
      --u;
    } else if (v[j] > u) {
      ans += u + real(1)/2;
      ++u;
    } else {
      ans += u;
    }
    if (i+2 > s[j+1]) ++j;
  }

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