#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n; cin >> n;
    vector<double> t(n + 2), v(n + 2);
    eFOR(i, 1, n)cin >> t[i];
    eFOR(i, 1, n)cin >> v[i];
    eFOR(i, 1, n)chmin(v[i], v[i - 1] + t[i]);
    erFOR(i, 1, n)chmin(v[i], v[i + 1] + t[i]);

    vector<pair<int, double>> sec;
    eFOR(i, 1, n) {
        if (v[i - 1] < v[i] && v[i] > v[i + 1]) {
            double z = t[i] - 2 * v[i] + v[i - 1] + v[i + 1];
            if (z < 0) {
                if (v[i - 1] < v[i + 1]) {
                    sec.emplace_back(1, v[i + 1] - v[i - 1]);
                    sec.emplace_back(1, (t[i] - v[i + 1] + v[i - 1]) / 2);
                    sec.emplace_back(-1, (t[i] - v[i + 1] + v[i - 1]) / 2);
                }
                else if (v[i - 1] > v[i + 1]) {
                    sec.emplace_back(1, (t[i] - v[i - 1] + v[i + 1]) / 2);
                    sec.emplace_back(-1, (t[i] - v[i - 1] + v[i + 1]) / 2);
                    sec.emplace_back(-1, v[i - 1] - v[i + 1]);
                }
                else {
                    sec.emplace_back(1, t[i] / 2);
                    sec.emplace_back(-1, t[i] / 2);
                }
            }
            else {
                sec.emplace_back(1, v[i] - v[i - 1]);
                sec.emplace_back(0, z);
                sec.emplace_back(-1, v[i] - v[i + 1]);
            }
        }
        else if (v[i - 1] < v[i]) {
            if (v[i] < v[i - 1] + t[i]) {
                sec.emplace_back(1, v[i] - v[i - 1]);
                sec.emplace_back(0, t[i] - v[i] + v[i - 1]);
            }
            else {
                sec.emplace_back(1, t[i]);
            }
        }
        else if (v[i] <= v[i + 1]) {
            sec.emplace_back(0, t[i]);
        }
        else {
            if (v[i] < v[i + 1] + t[i]) {
                sec.emplace_back(0, t[i] - v[i] + v[i + 1]);
                sec.emplace_back(-1, v[i] - v[i + 1]);
            }
            else {
                sec.emplace_back(-1, t[i]);
            }
        }
    }

    double ans = 0, speed = 0;
    for (auto i : sec) {
        int dir; double dis; tie(dir, dis) = i;

        if (dir == -1)speed -= dis;

        ans += speed * dis;
        if (dir != 0)ans += dis * dis / 2;

        if (dir == 1)speed += dis;
    }

    cout << ans << "\n";
}


Measured memory_bytes: 256