#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define FOR(i,n) for (int i = 0; i < n; i++)

double ecost[222222];
double cost[222222];
double bee[222222];
int n;
struct Edge {
  int to;
  double prob, cost;
};
vector<Edge> neigh[222222];
int deleted[222222];
vector<int> deleted_nodes;

void delete_node(int v) {
  int u = neigh[v][0].to;
  int w = neigh[v][1].to;
  int uv = 0, wv = 0;
  if (neigh[u][uv].to != v) uv++;
  if (neigh[w][wv].to != v) wv++;
  double pvu = neigh[v][0].prob;
  double cvu = neigh[v][0].cost;
  double pvw = neigh[v][1].prob;
  double cvw = neigh[v][1].cost;
  double &puv = neigh[u][uv].prob;
  double &cuv = neigh[u][uv].cost;
  double &put = neigh[u][!uv].prob;
  double &cut = neigh[u][!uv].cost;
  double &pwv = neigh[w][wv].prob;
  double &cwv = neigh[w][wv].cost;
  double &pwx = neigh[w][!wv].prob;
  double &cwx = neigh[w][!wv].cost;

  double puu = puv*pvu, cuu = cuv+cvu;
  double puw = puv*pvw, cuw = cuv+cvw;
  double pww = pwv*pvw, cww = cwv+cvw;
  double pwu = pwv*pvu, cwu = cwv+cvu;
  double newput = put / (put + puw), newcut = cut +       puu*cuu/(1-puu)/(1-puu) * (put+puw);
  double newpuw = puw / (put + puw), newcuw = cuv + cvw + puu*cuu/(1-puu)/(1-puu) * (put+puw);
  double newpwx = pwx / (pwx + pwu), newcwx = cwx +       pww*cww/(1-pww)/(1-pww) * (pwx+pwu);
  double newpwu = pwu / (pwx + pwu), newcwu = cwv + cvu + pww*cww/(1-pww)/(1-pww) * (pwx+pwu);
  neigh[u][uv].to = w; neigh[w][wv].to = u;
  put = newput; cut = newcut;
  puv = newpuw; cuv = newcuw;
  pwv = newpwu; cwv = newcwu;
  pwx = newpwx; cwx = newcwx;
}

void calc_ecost() {
  FOR(i,n) if (!deleted[i]) ecost[i] = cost[i]; else ecost[i] = -1e40;
  for (int i = (int)deleted_nodes.size()-1; i >= 0; i--) {
    int v = deleted_nodes[i];
    ecost[v] = 0;
    for (auto e : neigh[v]) {
      ecost[v] += e.prob * (e.cost + ecost[e.to]);
    }
  }
  FOR(i,n) {
    double shouldcost = cost[i];
    if (deleted[i]) shouldcost = -bee[i] + (ecost[(n+i-1)%n] + ecost[(i+1)%n]) * .5;
    if (fabs(shouldcost - ecost[i]) > 1e-8 && fabs(shouldcost/ecost[i] - 1) > 1e-8) {
      printf("%i should cost %g; does cost %g\n", i, shouldcost, ecost[i]);
    }
  }
}

int main() {
  scanf("%i", &n);
  FOR(i,n) scanf("%lf", cost+i);
  FOR(i,n) scanf("%lf", bee+i);
  FOR(i,n) {
    neigh[i].push_back(Edge{(i+1)%n, .5, -bee[i]});
    neigh[i].push_back(Edge{(n+i-1)%n, .5, -bee[i]});
  }
  queue<int> q;
  FOR(i,n) q.push(i);
  while (q.size()) {
    int x = q.front(); q.pop();
    if (deleted[x]) continue;
    double here = 0;
    for (auto e : neigh[x]) {
      here += e.prob * (e.cost + cost[e.to]);
    }
    if (here > cost[x]) {
      for (auto p : neigh[x]) q.push(p.to);
      delete_node(x);
      deleted[x] = 1;
      deleted_nodes.push_back(x);

      #if 0
      printf("set policy for %i to passthrough\n", x);
      calc_ecost();
      FOR(i,n) printf("%g ", ecost[i]);
      printf("\n");
      FOR(i,n) {
        printf("node %i cost %f bee %f", i, cost[i], bee[i]);
        for (auto e : neigh[i]) printf(" (to %i prob %g cost %g)", e.to, e.prob, e.cost);
        printf("\n");
      }
      #endif
    }
  }
  calc_ecost();
  double ans = 0;
  FOR(i,n) ans += ecost[i];
  ans /= n;
  printf("%.12f\n", ans);
}


Measured memory_bytes: 27768