Problem: Let's assume that we have a sequence of doubles a1, a2, ..., a|a| and a double variable x. You are allowed to perform the following two-staged operation:

  1. choose an index of the sequence element i (1 ≤ i ≤ |a|); 
  2. consecutively perform assignments: <image>. 



Let's use function g(a, x) to represent the largest value that can be obtained from variable x, using the described operation any number of times and sequence a.

Sereja has sequence b1, b2, ..., b|b|. Help Sereja calculate sum: <image>. Record [bi, bi + 1, ..., bj] represents a sequence containing the elements in brackets in the given order. To avoid problems with precision, please, print the required sum divided by |b|2.

Input

The first line contains integer |b| (1 ≤ |b| ≤ 3·105) — the length of sequence b. The second line contains |b| integers b1, b2, ..., b|b| (1 ≤ bi ≤ 105).

Output

In a single line print a real number — the required sum divided by |b|2. Your answer will be considered correct if its absolute or relative error won't exceed 10 - 6.

Examples

Input

5
1 2 3 4 1


Output

1.238750000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void readi(int &x);
const int maxn = 300005;
int n, b[maxn], id[maxn], rk[maxn];
double fl[maxn], fr[maxn];
bool cmpb(const int &i, const int &j) { return b[i] < b[j]; }
struct node {
  double div, dta;
  node *lc, *rc;
  inline void downdate() {
    if (div != 1)
      lc->div *= div, lc->dta *= div, rc->div *= div, rc->dta *= div, div = 1;
    if (dta != 0) lc->dta += dta, rc->dta += dta, dta = 0;
  }
  inline void modify(int l, int r, const int &a, const int &b, const double &c,
                     const double &d) {
    if (l >= a && r <= b)
      div *= c, dta *= c, dta += d;
    else {
      int mid = l + r >> 1;
      downdate();
      if (a <= mid) lc->modify(l, mid, a, b, c, d);
      if (b > mid) rc->modify(mid + 1, r, a, b, c, d);
    }
  }
  inline double get(int l, int r, const int &p) {
    if (l == r) return dta;
    int mid = l + r >> 1;
    downdate();
    if (p <= mid)
      return lc->get(l, mid, p);
    else
      return rc->get(mid + 1, r, p);
  }
} ndl[maxn * 3], *root;
int ns;
node *build(int l, int r) {
  node *c = ndl + ns++;
  c->dta = 0;
  c->div = 1;
  if (l == r)
    c->lc = c->rc = NULL;
  else {
    int mid = l + r >> 1;
    c->lc = build(l, mid);
    c->rc = build(mid + 1, r);
  }
  return c;
}
void build() { ns = 1, root = build(1, n); }
void init() {
  readi(n);
  for (int i = 1; i <= n; i++) readi(b[i]), id[i] = i;
  sort(id + 1, id + n + 1, cmpb);
  for (int i = 1; i <= n; i++) rk[id[i]] = i;
}
void work() {
  build();
  for (int i = 1; i <= n; i++) {
    root->modify(1, n, 1, n, 1, 1);
    if (rk[i] > 1) root->modify(1, n, 1, rk[i] - 1, .5, 0);
    fl[i] = root->get(1, n, rk[i]) / 2;
  }
  build();
  for (int i = n; i >= 1; i--) {
    root->modify(1, n, 1, n, 1, 1);
    if (rk[i] > 1) root->modify(1, n, 1, rk[i] - 1, .5, 0);
    fr[i] = root->get(1, n, rk[i]) / 2;
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) ans += fl[i] * fr[i] * b[i];
  ans /= (double)n * n;
  printf("%lf", (double)ans * 2);
}
int main() {
  init();
  work();
  return 0;
}
inline void readi(int &x) {
  char c;
  for (c = getchar(); c > '9' || c < '0'; c = getchar())
    ;
  x = c ^ '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
    x = x * 10 + (c ^ '0');
}