#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dump(x) cerr << #x " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define endl '\n'

#ifdef _DEBUG27_
    //#define STRESS 1
#endif

typedef long long llong;

const int INF = 2e9 + 999;
const llong LINF = 2e18 + 999;

void inv(bool e);
template<typename T> T sign(T a);
template<typename T> void die(T &a);
template<typename T> void umax(T &a, T b);
template<typename T> void umin(T &a, T b);

bool brute, alter;
int cnt_tests = 1;

// Get + in div1

// Code below

int n;

vector<double> t, limit;

void inp() {
    cin >> n;
    t.resize(n);
    limit.resize(n);
    for (auto & x : t) {
        cin >> x;
    }
    for (auto & x : limit) {
        cin >> x;
    }
}

double v[(int) 1e6], ans[(int) 1e6];

void solve() {
    for (int i = 1; i < n; i++) {
        t[i] += t[i - 1];
    }
    int p = 0;
    int total = 0;
    for (int i = 1; i <= t.back(); ++i) {
        v[i] = min(v[i - 1] + 1, limit[p]);
        if (p + 1 < n && t[p] == i) {
            ++p;
        }
    }
    v[(int)t.back()] = 0;
    p = n - 1;
    for (int i = t.back() - 1; i >= 0; --i) {
        double val = min(v[i + 1] + 1, limit[p]);
        umin(v[i], val);
        if (p - 1 >= 0 && t[p - 1] == i) {
            --p;
        }
    }
    p = 0;
    for (int i = 1; i <= t.back(); ++i) {
        ans[i] += ans[i - 1];
        if (v[i] > v[i - 1]) {
            ans[i] += v[i - 1] + 0.5;
        }
        if (v[i] < v[i - 1]) {
            ans[i] += v[i] + 0.5;
        }
        if (v[i] == v[i - 1]) {
            if (limit[p] == v[i]) {
                ans[i] += v[i];
            } else {
                ans[i] += v[i] + 0.25;
            }
        }
        if (p + 1 < n && t[p] == i) {
            ++p;
        }
    }
    cout << fixed << setprecision(10) << ans[(int)t.back()] << endl;
}

void stress() {

}

void naive() {

}

void run();
int main() {
    #ifdef _DEBUG27_
        if (1)
            freopen("input.txt", "r", stdin);
    #else
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (0) {
            freopen("palindrome.in", "r", stdin);
            freopen("palindrome.out", "w", stdout);
        }
    #endif
    srand(time(0));
    #ifdef STRESS
        brute = true;
    #else
        brute = false;
    #endif

    for (int i = 0; (i < cnt_tests); i++) {
        run();
    }

    #ifdef _DEBUG27_
        cout << endl << "Time: " << clock() / 1000.0 << " ms";
    #endif
    return 0;
}

void run() {
    if (!brute) {
        inp();
    }
    else {
        stress();
    }
    solve();
    cout << endl;
}

template<typename T>
void die(T &a) {
    cout << a;
    exit(0);
}

template<typename T>
T sign(T a) {
    if (a == 0)
        return 0;
    if (a < 0)
        return -1;
    return 1;
}

template<typename T>
void umax(T &a, T b) {
    if (b > a)
        a = b;
}

template<typename T>
void umin(T &a, T b) {
    if (b < a)
        a = b;
}

void inv(bool e) {
    if (!e) {
        vector<int> a;
        a[-1] += 1;
    }
}

/** CLEARING BUFFER

    cout << VAL << flush;

    OR

    printf(VAL);
    fflush(stdout);
*/


Measured memory_bytes: 2432