#include <iostream>
#include <iomanip>
using namespace std;

int main() {
	int n;cin>>n;
	int t[n],v[n];
	int time=0;
	for(int i=0;i<n;i++){
		cin>>t[i];
		time+=t[i];
	}
	for(int i=0;i<n;i++)cin>>v[i];
	double speed[2*time+1];

	int k=1;
	for(int i=0;i<n;i++){
		if(i){
			if(v[i]<v[i-1])speed[k-1]=v[i];
		}
		for(int j=0;j<2*t[i];j++){
			speed[k]=v[i];
			k++;
		}
	}
	speed[0]=0;speed[2*time]=0;
	for(int i=1;i<2*time+1;i++){
		if(speed[i-1]+0.5<speed[i]){
			speed[i]=speed[i-1]+0.5;
		}
	}

	for(int i=2*time-1;i>0;i--){
		if(speed[i+1]+0.5<speed[i]){
			speed[i]=speed[i+1]+0.5;
		}
	}
	double ans=0;
	for(int i=1;i<2*time+1;i++){
		ans+=(speed[i-1]+speed[i])/4;
	}
	cout<<setprecision(15)<<ans<<endl;

		return 0;
}
