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 reader_pt = 1048576, reader_last;
char reader_buf[1048576];
int reader_nonneg_int() {
  int r;
  for (;;) {
    if (reader_pt == 1048576)
      reader_pt = 0,
      reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
    if (('0' <= (reader_buf[reader_pt]) && (reader_buf[reader_pt]) <= '9'))
      break;
    reader_pt++;
  }
  r = reader_buf[reader_pt++] - '0';
  for (;;) {
    if (reader_pt == 1048576)
      reader_pt = 0,
      reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
    if (!('0' <= (reader_buf[reader_pt]) && (reader_buf[reader_pt]) <= '9'))
      break;
    r = r * 10 + (reader_buf[reader_pt++] - '0');
  }
  reader_pt++;
  return r;
}
double solve_brute(int n, int in[]) {
  int i, j, k, s;
  int arr[100];
  double res = 0, tmp;
  for (i = 0; i < n; i++)
    for (j = i; j < n; j++) {
      s = 0;
      for (k = i; k < j + 1; k++) arr[s++] = in[k];
      tmp = 0;
      sort(arr, arr + s);
      for (k = 0; k < s; k++) tmp = (tmp + arr[k]) / 2;
      res += tmp;
    }
  res /= n;
  res /= n;
  return res;
}
int main() {
  int i, j, k, kk, l, m, n, x, y;
  static int a[500000];
  static pair<int, int> srt[500000];
  set<int> ind;
  set<int>::iterator it, it1, it2;
  int ss[25], ls[25];
  double pw[100], res;
  pw[0] = 1;
  for (i = 1; i < 100; i++) pw[i] = pw[i - 1] * 0.5;
  n = reader_nonneg_int();
  for (i = 0; i < n; i++) a[i] = reader_nonneg_int();
  for (i = 0; i < n; i++) srt[i] = make_pair(a[i], i);
  sort(srt, srt + n);
  res = 0;
  ind.clear();
  ind.insert(-1);
  ind.insert(n);
  for (kk = n - 1; kk >= 0; kk--) {
    k = srt[kk].second;
    ind.insert(k);
    it = ind.lower_bound(k);
    it1 = it2 = it;
    for (i = 0; i < 25; i++) ss[i] = ls[i] = 0;
    x = 0;
    for (i = 0; i < 25; i++) {
      it1--;
      y = ss[i] = k - (*it1);
      ss[i] -= x;
      x = y;
      if ((*it1) == -1) break;
    }
    x = 0;
    for (i = 0; i < 25; i++) {
      it2++;
      y = ls[i] = (*it2) - k;
      ls[i] -= x;
      x = y;
      if ((*it2) == n) break;
    }
    for (i = 0; i < 25; i++)
      if (ss[i])
        for (j = 0; j < 25; j++)
          if (ls[j]) {
            res += pw[i + j + 1] * a[k] * ss[i] * ls[j];
          }
  }
  res /= n;
  res /= n;
  printf("%.15f\n", res);
  return 0;
}