#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n; cin >> n;
  VI t(n); for (int i = 0; i < n; i++) cin >> t[i];
  VI v(n + 1); for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = n - 1; i >= 0; i--) {
    v[i] = min(v[i], v[i + 1] + t[i]);
  }
  for (int i = 0; i < n; i++) {
    t[i] <<= 1;
    v[i] <<= 1;
  }
  double res = 0.0;
  int tmp = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < t[i]; j++) {
      res += min({v[i], j + tmp, -(j - t[i]) + v[i + 1]});
    }
    tmp = min({v[i], t[i] + tmp, v[i + 1]});
  }
  res /= 4.0;
  cout << fixed << setprecision(5) << res << '\n';
  return 0;
}