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;
int n, i, j, p, b[310000], tx[310000];
double ans, pia[310000], sum[410000], mu[410000];
struct aa {
  double mul, sum;
  aa operator+(aa b) {
    aa c;
    c.mul = mul * b.mul;
    c.sum = sum + mul * b.sum;
    return c;
  }
} s[1210000];
bool cmp(int x, int y) {
  if (b[x] != b[y]) return b[x] > b[y];
  return x < y;
}
aa get(int k, int q, int h, int l, int r) {
  if (l <= q && h <= r) return s[k];
  if (r <= (q + h) / 2) return get(k * 2, q, (q + h) / 2, l, r);
  if ((q + h) / 2 < l) return get(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
  return get(k * 2, q, (q + h) / 2, l, r) +
         get(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
}
void modify(int k, int q, int h, int x) {
  if (q == h) {
    s[k].mul /= 2;
    s[k].sum /= 2;
  } else {
    if (x <= (q + h) / 2)
      modify(k * 2, q, (q + h) / 2, x);
    else
      modify(k * 2 + 1, (q + h) / 2 + 1, h, x);
    s[k] = s[k * 2] + s[k * 2 + 1];
  }
}
void mkt(int k, int q, int h) {
  if (q < h) {
    mkt(k * 2, q, (q + h) / 2);
    mkt(k * 2 + 1, (q + h) / 2 + 1, h);
    s[k] = s[k * 2] + s[k * 2 + 1];
  } else
    s[k].mul = 1, s[k].sum = 0.5;
}
void downdate(int k, int l) {
  sum[k] *= mu[k];
  if (l > 1) {
    mu[k * 2] *= mu[k];
    mu[k * 2 + 1] *= mu[k];
  }
  mu[k] = 1;
}
void mul(int k, int q, int h, int l, int r) {
  downdate(k, h - q + 1);
  if (l <= q && h <= r)
    mu[k] /= 2;
  else {
    if (r <= (q + h) / 2)
      mul(k * 2, q, (q + h) / 2, l, r);
    else if ((q + h) / 2 < l)
      mul(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
    else
      mul(k * 2, q, (q + h) / 2, l, r),
          mul(k * 2 + 1, (q + h) / 2 + 1, h, l, r);
    sum[k] = sum[k * 2] * mu[k * 2] + sum[k * 2 + 1] * mu[k * 2 + 1];
  }
}
void inc(int k, int q, int h, int x, double y) {
  downdate(k, h - q + 1);
  if (q == h)
    sum[k] += y;
  else {
    if (x <= (q + h) / 2)
      inc(k * 2, q, (q + h) / 2, x, y);
    else
      inc(k * 2 + 1, (q + h) / 2 + 1, h, x, y);
    sum[k] = sum[k * 2] * mu[k * 2] + sum[k * 2 + 1] * mu[k * 2 + 1];
  }
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= n; i++) tx[i] = i;
  sort(tx + 1, tx + n + 1, cmp);
  mkt(1, 1, n);
  for (i = 1; i <= n; i++) {
    pia[tx[i]] = get(1, 1, n, tx[i], n).sum;
    modify(1, 1, n, tx[i]);
  }
  for (i = n; i; i--) {
    mul(1, 1, 100000, 1, b[i]);
    inc(1, 1, 100000, b[i], b[i] * pia[i]);
    ans += sum[1] * mu[1];
  }
  printf("%.10lf\n", ans / n / n);
}