#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF (1 << 30)

template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};

typedef ModInt<MOD> mint;

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
  int n = ri();
  int t[n];
  int tt[n+1];
  int v[n];
  INPUT(t);
  INPUT(v);
  int sec_sum = 0;
  FOR(i,n) sec_sum += t[i];
  tt[0] = 0;
  FOR(i,n) tt[i+1] = tt[i]+t[i];
  
  int limit[sec_sum+1];
  FOR(i,sec_sum+1) {
    limit[i] = i;
    limit[i] = min((s64)limit[i], sec_sum - i);
    FOR(j,n) {
      if (tt[j+1]<=i) limit[i] = min((s64)limit[i], v[j]+abs(i-tt[j+1]));
      else if (tt[j]>=i) limit[i] = min((s64)limit[i], v[j]+abs(i-tt[j]));
      else limit[i] = min(limit[i], v[j]);
    }
    // cout << i << ":" << limit[i] << endl;
  }
  double res = 0;
  
  FOR(i,sec_sum) {
    if (limit[i] == limit[i+1]) {
      bool accel = false;
      FOR(j,n) {
        if (tt[j+1]>=i+1 && tt[j]<=i) {
          if (v[j]>limit[i]) accel = true;
          else accel = false;
          break;
        }
      }
      res += limit[i];
      if (accel) res += 0.25;
    } else {
      assert(abs(limit[i]-limit[i+1]) == 1);
      int minn = min(limit[i], limit[i+1]);
      res += minn;
      res += 0.5;
    }
      
  }
  
  printf("%.5f",res);
  
  return 0;
}

    

Measured memory_bytes: 384