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;
struct SegmentTreeDivideRange {
  int size;
  int treeSize;
  vector<double> SUM;
  vector<int> LAZY;
  SegmentTreeDivideRange(int sz) {
    size = sz;
    treeSize = 4 * sz;
    SUM.resize(treeSize);
    LAZY.resize(treeSize);
  }
  void push(int x, int l, int r) {
    if (l < r) {
      LAZY[x + x] += LAZY[x];
      LAZY[x + x + 1] += LAZY[x];
    }
    apply(x);
  }
  inline void apply(int x) {
    const int M = 60;
    int k = LAZY[x];
    if (k >= M + M)
      SUM[x] = 0;
    else {
      while (k >= M) {
        SUM[x] /= (1LL << M);
        k -= M;
      }
      SUM[x] /= (1LL << k);
    }
    LAZY[x] = 0;
  }
  void UpdateOne(int pp, double val) { UpdateOne(1, 0, size - 1, pp, val); }
  void UpdateOne(int x, int l, int r, int pp, double val) {
    push(x, l, r);
    if (l > pp || r < pp) return;
    if (l == r) {
      SUM[x] += val;
      push(x, l, r);
      return;
    }
    int y = (l + r) >> 1;
    UpdateOne(x + x, l, y, pp, val);
    UpdateOne(x + x + 1, y + 1, r, pp, val);
    Correct(x);
  }
  void UpdateRange(int ll, int rr, int val) {
    UpdateRange(1, 0, size - 1, ll, rr, val);
  }
  inline void Correct(int x) { SUM[x] = SUM[x + x] + SUM[x + x + 1]; }
  void UpdateRange(int x, int l, int r, int ll, int rr, int val) {
    push(x, l, r);
    if (ll > r || l > rr) return;
    if (ll <= l && r <= rr) {
      LAZY[x] += val;
      push(x, l, r);
      return;
    }
    int y = (l + r) >> 1;
    UpdateRange(x + x, l, y, ll, rr, val);
    UpdateRange(x + x + 1, y + 1, r, ll, rr, val);
    Correct(x);
  }
  double Query(int ll, int rr) { return Query(1, 0, size - 1, ll, rr); }
  double Query(int x, int l, int r, int ll, int rr) {
    push(x, l, r);
    if (ll > r || l > rr) return 0;
    if (ll <= l && r <= rr) {
      return SUM[x];
    }
    int y = (l + r) >> 1;
    return Query(x + x, l, y, ll, rr) + Query(x + x + 1, y + 1, r, ll, rr);
  }
};
int main() {
  int n;
  cin >> n;
  pair<double, int> bb[n];
  int b[n];
  int r[n];
  double coefSum = 0;
  double ret = 0;
  SegmentTreeDivideRange sum(n), coef(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    bb[i] = {b[i], i};
  }
  sort(bb, bb + n);
  for (int i = 0; i < n; ++i) r[bb[i].second] = i;
  for (int i = 0; i < n; ++i) {
    if (b[i] > 0) {
      double oldCoefSum = coefSum;
      coefSum = coefSum / 2 + (i + 1) / 2.0;
      coef.UpdateRange(0, r[i] - 1, 1);
      sum.UpdateRange(0, r[i] - 1, 1);
      double newCoef = coefSum - oldCoefSum + coef.Query(0, r[i] - 1);
      coef.UpdateOne(r[i], newCoef);
      sum.UpdateOne(r[i], newCoef * b[i]);
    }
    ret += sum.Query(0, n - 1);
  }
  ret /= n;
  ret /= n;
  cout << setprecision(20) << ret << endl;
  return 0;
}