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 long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y,
                     long long _mod = 1000000007ll) {
  long long _ = _x + _y;
  if (_ >= _mod) _ -= _mod;
  return _;
}
inline long long sub(long long _x, long long _y,
                     long long _mod = 1000000007ll) {
  long long _ = _x - _y;
  if (_ < 0) _ += _mod;
  return _;
}
inline long long mul(long long _x, long long _y,
                     long long _mod = 1000000007ll) {
  long long _ = _x * _y;
  if (_ >= _mod) _ %= _mod;
  return _;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1ll;
  long long _tmp = mypow(_a, _x / 2, _mod);
  _tmp = mul(_tmp, _tmp, _mod);
  if (_x & 1) _tmp = mul(_tmp, _a, _mod);
  return _tmp;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0ll;
  long long _tmp = mymul(_a, _x / 2, _mod);
  _tmp = add(_tmp, _tmp, _mod);
  if (_x & 1) _tmp = add(_tmp, _a, _mod);
  return _tmp;
}
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int __ = 1, _cs;
double p2[45];
void build() {
  p2[0] = 1;
  for (int i = 1; i < 45; i++) p2[i] = p2[i - 1] * 2.0;
}
int n;
int a[303030];
vector<pair<int, int> > v;
void init() {
  n = getint();
  for (int i = 1; i <= n; i++) {
    a[i] = getint();
    v.push_back({a[i], i});
  }
  sort((v).begin(), (v).end());
}
int tlft[303030], trgt[303030];
void solve() {
  for (int i = 1; i <= n; i++) {
    tlft[i] = i - 1;
    trgt[i] = i + 1;
  }
  double ans = 0.0;
  for (size_t _ = 0; _ < v.size(); _++) {
    int i = v[_].second;
    double tl = 0.0, tr = 0.0;
    int pl = i, pr = i;
    for (int j = 0; j < 45; j++) {
      if (pl != 0) tl += (pl - tlft[pl]) / p2[j], pl = tlft[pl];
      if (pr <= n) tr += (trgt[pr] - pr) / p2[j], pr = trgt[pr];
    }
    tlft[trgt[i]] = tlft[i];
    trgt[tlft[i]] = trgt[i];
    ans += tl * tr * a[i] * 0.5;
  }
  printf("%.12f\n", ans / ((double)n * (double)n));
}
int main() {
  build();
  while (__--) {
    init();
    solve();
  }
}