// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



#define MXN 20005

// #define debug



int mx[MXN], t[MXN], v[MXN], en;

double memo[MXN][105]; 

bool visited[MXN][105];

const int inf = 0x3f3f3f3f;



double dfs(int cur, int speed) {

    if (cur == en+1) {

        if (speed) return -inf;

        else return 0;

    }

    if (visited[cur][speed]) return memo[cur][speed];

    visited[cur][speed] = 1;

    double res = -inf;

    if (speed < mx[cur]) {

        res = max(res, dfs(cur+1, speed) + speed);

        res = max(res, dfs(cur+1, speed) + speed+0.25);

        res = max(res, dfs(cur+1, speed+1) + speed+0.5);

        if (speed) 

            res = max(res, dfs(cur+1, speed-1) + speed-0.5);

    } else if (speed == mx[cur]) {

        res = max(res, dfs(cur+1, speed) + speed);

        res = max(res, dfs(cur+1, speed-1) + speed-0.5);

    } 

    return memo[cur][speed] = res;

}



int main() { 

    int n;

    while (cin >> n) {

        en = 0;

        for (int i = 0; i < n; ++i) {

            cin >> t[i];

            en += t[i];

        }

        for (int i = 0; i < n; ++i) cin >> v[i];

        int cur = 1, tmp;

        for (int i = 0; i < n; ++i) {

            tmp = t[i];

            while (tmp--) {

                mx[cur++] = v[i];

            }

        }

#ifdef debug

        for (int i = 1; i <= en; ++i) {

            cout << mx[i] << " ";

        }

        cout << "\n";

#endif

        memset(visited, 0, sizeof(visited));

        printf("%.9lf\n", dfs(1, 0));

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <cstdlib>

#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

#define rep(x, n) for (int x = 1; x <= n; ++x)

#define FOR(x, l, r) for (int x = l; x <= r; ++x)

const int maxN = 505;

struct T

{

	double l, r, bg;

	int a;

	double ed()

	{

		return bg + a * (r - l);

	}

	double dis()

	{

		return (bg + ed()) * (r - l) * 0.5;

	}

	void print()

	{

		cout << l << " " << r << " " << bg << " " << a << endl;

	}

}st[maxN];

int v[maxN], t[maxN], n, top;



void add(double l, double r, double bg, int a)

{

	++top;

	st[top].l = l; st[top].r = r;

	st[top].bg = bg; st[top].a = a;

}



void make(double v)

{

	if (st[top].ed() <= v) return;

	double l = st[top].l, r = st[top].r;

	double bg = st[top].bg;

	if (bg > v + (r - l))

	{

		top--;

		make(v + (r - l));

		add(l, r, v + (r - l), -1);

	}

	else

	{

		double a = st[top].a;

		double x = (v + r + l * a - bg) / (1 + a);

		st[top].r = x;

		add(x, r, v + r - x, -1);

	}

}



int main()

{

	scanf("%d", &n);

	rep(i, n) scanf("%d", t + i);

	rep(i, n) scanf("%d", v + i);



	add(-1, 0, 0, 0);



	double ti = 0;

	rep(i, n)

	{

		make(v[i]);

		double last = st[top].ed();

		if (t[i] > (v[i] - last))

		{

			add(ti, ti + v[i] - last, last, 1);

			add(ti + v[i] - last, ti + t[i], v[i], 0);

		}

		else

		{

			add(ti, ti + t[i], last, 1);

		}

		ti += t[i];

	}

	make(0.0);



	double ans = 0;

	rep(i, top) ans += st[i].dis();



	printf("%.10lf\n", ans);

	return 0;

}


// Fastest known solution for this problem: