#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <cmath>
#include <string>
#include <iomanip>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 2000006;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

ll t[500], v[5000],st[200000], s[200000], c[300], vis[200000];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        ll sum=0;
        cin>>n;
        rep1(i,1,n)
        {
            cin>>t[i];
            sum+=t[i];
            st[i]=c[i-1];
            c[i]=c[i-1]+t[i];
        }

        rep1(i,1,n)
            cin>>v[i];

        v[n+1]=5000;
        s[0]=0;
        for(i=1;i<=sum;i++)
            s[i]=s[i-1]+1;

        s[sum]=0;
        for(i=sum-1;i>=0;i--)
            s[i]=min(s[i+1]+1, s[i]);


        for(i=1;i<=sum;i++)
        {
            for(j=1;j<=n;j++)
            {
                if(i<st[j])
                {
                    //if(j==6 and i==5)
                      //  cout<<v[j]<<" "<<st[j]<<endl;
                    s[i]=min(s[i], v[j] + st[j] - i);

                }
                else if(i>=c[j])
                {
                    s[i]=min(s[i], v[j] + i - c[j]);
                }
            }
            //cout<<s[5]<<endl;
        }

        //cout<<s[5]<<endl;
        int idx = 1;
//        cout<<c[idx]<<" "<<v[idx]<<endl;
        for(i=1;i<=sum;i++)
        {
//            if(v[idx]<=s[i])
//            {
//                v[idx]=s[idx];
//                vis[i]=1;
//            }
            if(c[idx] <= i)
                idx++;
            if(v[idx] <= s[i])
            {
                s[i]=v[idx];
                vis[i]=1;
            }
        }
//
//        rep(i,sum+1)
//            cout<<s[i]<<" ";
//        cout<<endl;
//
//        rep(i,sum+1)
//        cout<<vis[i]<<" ";
//        cout<<endl;
        lf ans=0.0;
        for(i=0;i<sum;i++)
        {
            if(s[i+1]<s[i])
                ans+=((lf)s[i+1] + 0.5);
            else if(s[i+1]>s[i])
                ans+=((lf)s[i] + 0.5);
            else if(s[i]==s[i+1])
            {
                if(vis[i]==1 and vis[i+1]==1)
                    ans+=((lf)s[i]);
                else if((vis[i]==0 and vis[i+1]==0) or(vis[i]==0 and vis[i+1]==1))
                    ans+=((lf)s[i]+0.25);
                else
                    ans+=(s[i]);
            }
        }

        cout<<pset(6)<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 2688