void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.typecons, std.math;

  int n; rd(n);
  auto _t=readln.split.to!(int[]);
  auto _v=readln.split.to!(int[]);

  alias S=Tuple!(int, "l", int, "r");
  auto seq=new S[](n);
  foreach(ref e; seq) e.l=-1, e.r=-1;
  alias Data=Tuple!(int, "v", int, "t", int, "i");
  auto data=new Data[](0);
  foreach(i; 0..n) data~=Data(_v[i], _t[i], i);
  sort(data);
  seq[0].l=seq[$-1].r=0;
  double sum=0;
  foreach(e; data){
    auto i=e.i, v=e.v, t=e.t;
    if(seq[i].l>=0 && seq[i].r>=0){
      auto u1=min(seq[i].l, seq[i].r);
      auto u2=max(seq[i].l, seq[i].r);
      sum+=u1*t;
      if((v-u1)+(v-u2)<=t){
        sum+=(v-u1)*(v-u1)*0.5;
        sum+=((u2-u1)+(v-u1))*(v-u2)*0.5;
        sum+=(v-u1)*(t-((v-u1)+(v-u2)));
      }else{
        auto x=(t+u2-u1)*0.5;
        sum+=x*x*0.5+(x+(u2-u1))*(t-x)*0.5;
      }
    }else if(seq[i].l<0 && seq[i].r<0){
      sum+=v*t;
      if(i-1>=0) seq[i-1].r=v;
      if(i+1<n) seq[i+1].l=v;
    }else{
      auto u=max(seq[i].l, seq[i].r);
      sum+=u*t;
      if(v-u<=t) sum+=(t-(v-u)+t)*(v-u)*0.5;
      else sum+=t*t*0.5;
      if(seq[i].l<0 && i-1>=0) seq[i-1].r=min(v, t+u);
      if(seq[i].r<0 && i+1<n) seq[i+1].l=min(v, t+u);
    }
  }
  writefln("%.10f", sum);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}