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;
const int MAXBUF = 1 << 23;
char B[MAXBUF], *Si = B, *Ti = B;
inline char getc() {
  if (Si == Ti) Ti = (Si = B) + fread(B, 1, MAXBUF, stdin);
  if (Si == Ti)
    return 0;
  else
    return *Si++;
}
template <class T>
inline void read(T &a) {
  static char c;
  static int fh;
  while (((c = getc()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    fh = -1, a = 0;
  else
    fh = 1, a = c - '0';
  while ((c = getc()) <= '9' && c >= '0') a = (a << 3) + (a << 1) + c - '0';
  if (fh == -1) a = -a;
}
char Buff[MAXBUF], *sti = Buff;
template <class T>
inline void write(T a) {
  if (a == 0) {
    *sti++ = '0';
    return;
  }
  if (a < 0) *sti++ = '-', a = -a;
  static char c[20];
  static int c0;
  c0 = 0;
  while (a) c[c0++] = a % 10 + '0', a /= 10;
  while (c0--) *sti++ = c[c0];
}
int a[1000005], n;
int pre[1000005], nxt[1000005];
int sl[85], sr[85], cl = 0, cr = 0;
int pl[85], pr[85];
double ans = 0.0;
struct node {
  int num, id;
} p[1000005];
inline bool cmp(node a, node b) {
  if (a.num != b.num) return a.num < b.num;
  return a.id < b.id;
}
int main() {
  int i, j;
  read(n);
  double orz = 0.5;
  orz /= ((double)(n));
  orz /= ((double)(n));
  nxt[0] = 1;
  pre[n + 1] = n;
  for (i = 1; i <= n; i++) {
    nxt[i] = i + 1;
    pre[i] = i - 1;
  }
  for (i = 1; i <= n; i++) {
    read(a[i]);
    p[i].num = a[i];
    p[i].id = i;
  }
  sort(p + 1, p + n + 1, cmp);
  for (i = 1; i <= n; i++) {
    cl = cr = 0;
    for (j = p[i].id; j != n + 1 && cr <= 80; j = nxt[j]) pr[++cr] = j;
    for (j = p[i].id; j && cl <= 80; j = pre[j]) pl[++cl] = j;
    pl[++cl] = 0;
    pr[++cr] = n + 1;
    pre[nxt[p[i].id]] = pre[p[i].id];
    nxt[pre[p[i].id]] = nxt[p[i].id];
    double c1 = 0.0, c2 = 0.0, tp = 1.0;
    for (j = 1; j < cl; j++) {
      sl[j] = pl[j] - pl[j + 1];
      c1 += 1.0 * sl[j] * tp;
      tp *= 0.5;
    }
    tp = 1.0;
    for (j = 1; j < cr; j++) {
      sr[j] = pr[j + 1] - pr[j];
      c2 += 1.0 * sr[j] * tp;
      tp *= 0.5;
    }
    double ovo = c1 * c2 * orz;
    ovo *= ((double)(p[i].num));
    ans += ovo;
  }
  printf("%.12lf\n", ans);
  return 0;
}