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;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int b[300111], nxt[300111];
int pre[300111];
pair<int, int> arr[300111];
int nn;
set<int> s;
set<int>::iterator it;
double pw[300111];
int lft[300111], rgt[300111];
int c[2];
int main() {
  pw[0] = 1;
  for (int i = 1; i < 1111; i++) pw[i] = pw[i - 1] / 2;
  int n;
  cin >> n;
  s.insert(0);
  s.insert(n + 1);
  nxt[0] = n + 1;
  pre[n + 1] = 0;
  for (int i = 1; i <= n; i++) gn(b[i]), arr[nn++] = pair<int, int>(b[i], i);
  sort(arr, arr + nn);
  double ans = 0;
  for (int i = nn; i--;) {
    int now = arr[i].second;
    it = s.upper_bound(now);
    rgt[0] = *it;
    it--;
    lft[0] = *it;
    s.insert(now);
    nxt[now] = rgt[0];
    pre[now] = lft[0];
    pre[rgt[0]] = now;
    nxt[lft[0]] = now;
    c[0] = c[1] = 1;
    lft[0] = rgt[0] = now;
    double A = 0, B = 0;
    for (; c[0] < 50 and lft[c[0] - 1]; c[0]++) {
      lft[c[0]] = pre[lft[c[0] - 1]];
      A += (lft[c[0] - 1] - lft[c[0]]) * pw[c[0]];
    }
    for (; c[1] < 50 and rgt[c[1] - 1] <= n; c[1]++) {
      rgt[c[1]] = nxt[rgt[c[1] - 1]];
      B += (rgt[c[1]] - rgt[c[1] - 1]) * pw[c[1]];
    }
    ans += A * B * (2 * arr[i].first);
  }
  printf("%.9lf\n", ans / n / n);
  return 0;
}