// Slower C++ solution:
#include <utility> // pair make_pair

using std::swap; // c++11

using std::pair;

using std::make_pair;

#include <tuple> // tuple(c++11) make_tuple(c++11)

using std::tuple; // get<address>(variable)

using std::make_tuple;

#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)

using std::string;

using std::stoi;

using std::stoll;

using std::to_string;

#include <queue> // queue priority_queue

using std::queue;

using std::priority_queue;

#include <stack> // stack

using std::stack;

#include <vector> // vector

using std::vector;

#include <map> // map

using std::map;

#include <set> // set

using std::set; // insert erase find count

#include <algorithm> // min max

using std::sort;

using std::lower_bound; // iterator,  >=

using std::upper_bound; // iterator,  >

using std::min;

using std::max;

using std::min_element; // iterator

using std::max_element; // iterator

#include <complex> // complex

using std::complex; // real imag

#include <iostream> // cin cout

using std::cin;

using std::cout;

using std::endl;

#include <iomanip> // setprecision fixed(manipulator)

using std::setprecision;

using std::fixed;

#include <cmath>

#include <cstdio>



#define lli long long int

#define INF (int)1e09

#define FOR(i, m, n) for (int i = m; i < n; i++)

#define EFOR(i, m, n) for (int i = m; i <= n; i++)

#define RFOR(i, m, n) for (int i = m; i > n; i--)

#define REFOR(i, m, n) for (int i = m; i >= n; i--)

#define VSORT(v) sort((v).begin(), (v).end()) // sort vector

typedef pair<int, int> PI;

typedef tuple<int, int, int> TI;

template <typename T> using Vec = vector<T>; // c++11





int main(void) {

    int n;

    cin >> n;

    Vec<int> t(n);

    Vec<int> v(n);

    int time = 0;

    FOR (loop, 0, n) {

        cin >> t[loop];

        time += t[loop];

    }

    FOR (loop, 0, n) {

        cin >> v[loop];

    }



    Vec<int> sped(10 * time + 1, 0);

    Vec<int> max_s(10 * time + 1);

    int rui = 0; // ruiseki_time

    max_s[0] = 0;

    FOR (i, 0, n) {

        FOR (j, 10 * rui, 10 * (rui + t[i])) {

            max_s[j] = v[i] * 10;

        }

        if (i != 0) {

            max_s[10 * rui] = min(v[i], v[i - 1]) * 10;

        }

        rui += t[i];

    }



    while (1) {

        bool change = false;

        // operation

        FOR (i, 1, 10 * time) {

            sped[i] += 1;

            if (abs(sped[i - 1] - sped[i]) > 1 || abs(sped[i + 1] - sped[i]) > 1 || sped[i] > max_s[i]) {

                sped[i] -= 1;

            } else {

                change = true;

            }

        }

        if (change == false) {

            break;

        }

    }

    /*

    FOR (i, 0, 10 * time) {

        cout << (double)(i) / 10 << " " << (double)(sped[i]) / 10 << " " << (double)(max_s[i]) / 10 << endl;

    }

     */



    double total = 0;

    FOR (i, 0, 10 * time) {

        int status = sped[i + 1] - sped[i];

        if (status == 1) {

            total += sped[i + 1] * 2 - 1;

        } else if (status == 0) {

            total += sped[i] * 2;

        } else {

            total += sped[i] * 2 - 1;

        }

    }

    total /= 200;

    cout << std::fixed << setprecision(4) << total << endl;



    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 1.370108812722165x):
#include <utility> // pair make_pair

using std::swap; // c++11

using std::pair;

using std::make_pair;

#include <tuple> // tuple(c++11) make_tuple(c++11)

using std::tuple; // get<address>(variable)

using std::make_tuple;

#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)

using std::string;

using std::stoi;

using std::stoll;

using std::to_string;

#include <queue> // queue priority_queue

using std::queue;

using std::priority_queue;

#include <stack> // stack

using std::stack;

#include <vector> // vector

using std::vector;

#include <map> // map

using std::map;

#include <set> // set

using std::set; // insert erase find count

#include <algorithm> // min max

using std::sort;

using std::lower_bound; // iterator,  >=

using std::upper_bound; // iterator,  >

using std::min;

using std::max;

using std::min_element; // iterator

using std::max_element; // iterator

#include <complex> // complex

using std::complex; // real imag

#include <iostream> // cin cout

using std::cin;

using std::cout;

using std::endl;

#include <iomanip> // setprecision fixed(manipulator)

using std::setprecision;

using std::fixed;

#include <cmath>

#include <cstdio>



#define lli long long int

#define INF (int)1e09

#define FOR(i, m, n) for (int i = m; i < n; i++)

#define EFOR(i, m, n) for (int i = m; i <= n; i++)

#define RFOR(i, m, n) for (int i = m; i > n; i--)

#define REFOR(i, m, n) for (int i = m; i >= n; i--)

#define VSORT(v) sort((v).begin(), (v).end()) // sort vector

typedef pair<int, int> PI;

typedef tuple<int, int, int> TI;

template <typename T> using Vec = vector<T>; // c++11

#define SEP 2





int main(void) {

    int n;

    cin >> n;

    Vec<int> t(n);

    Vec<int> v(n);

    int time = 0;

    FOR (loop, 0, n) {

        cin >> t[loop];

        time += t[loop];

    }

    FOR (loop, 0, n) {

        cin >> v[loop];

    }



    Vec<int> sped(SEP * time + 1, 0);

    Vec<int> max_s(SEP * time + 1);

    int rui = 0; // ruiseki_time

    max_s[0] = 0;

    FOR (i, 0, n) {

        FOR (j, SEP * rui, SEP * (rui + t[i])) {

            max_s[j] = v[i] * SEP;

        }

        if (i != 0) {

            max_s[SEP * rui] = min(v[i], v[i - 1]) * SEP;

        }

        rui += t[i];

    }



    while (1) {

        bool change = false;

        // operation

        FOR (i, 1, SEP * time) {

            sped[i] += 1;

            if (abs(sped[i - 1] - sped[i]) > 1 || abs(sped[i + 1] - sped[i]) > 1 || sped[i] > max_s[i]) {

                sped[i] -= 1;

            } else {

                change = true;

            }

        }

        if (change == false) {

            break;

        }

    }

    /*

    FOR (i, 0, SEP * time) {

        cout << (double)(i) / SEP << " " << (double)(sped[i]) / SEP << " " << (double)(max_s[i]) / SEP << endl;

    }

     */



    double total = 0;

    FOR (i, 0, SEP * time) {

        int status = sped[i + 1] - sped[i];

        if (status == 1) {

            total += sped[i + 1] * 2 - 1;

        } else if (status == 0) {

            total += sped[i] * 2;

        } else {

            total += sped[i] * 2 - 1;

        }

    }

    total /= (2 * SEP * SEP);

    cout << std::fixed << setprecision(4) << total << endl;



    return 0;

}