#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin>>N;
  std::vector<double> t(N),v(N);
  for(int i=0;i<N;i++)cin>>t[i];
  for(int i=0;i<N;i++)cin>>v[i];
  double ts=0;
  for(int i=0;i<N;i++)ts+=t[i];
  std::vector<double> lo(ts*2+1);
  for(double i=0;i<2*ts+1;i++)lo[i]=i/2;
  for(double i=0;i<2*ts+1;i++)lo[2*ts-i]=min(lo[i],i/2);
  double tnow=0;
  for(double i=0;i<N;i++){
    for(double j=0;j<2*ts+1;j++){
      if(j<tnow)lo[j]=min(lo[j],v[i]+(tnow-j)/2);
      if(j>=tnow&&j<=tnow+t[i]*2)lo[j]=min(lo[j],v[i]);
      if(j>tnow+t[i]*2)lo[j]=min(lo[j],v[i]+(j-tnow-t[i]*2)/2);
    }
    tnow+=t[i]*2;
  }
  double ans=0;
  for(double i=1;i<ts*2+1;i++)ans+=(lo[i]+lo[i-1])/4;
  //for(double i=0;i<ts*2+1;i++)cout<<lo[i]<<endl;
  cout<<fixed<<setprecision(12)<<ans<<endl;
}
