Problem: problem

AOR Ika got a water tank with a size of $ 1 $ in length and $ N $ in width. The aquarium is tall enough to hold water. The aquarium has $ N-1 $ partitions and is evenly spaced into $ N $ compartments. When water was poured here, the height of the water in each section became $ a_i $.

AOR Ika decided to remove some dividers and reduce the number of compartments to $ M $ or less. When you have removed the dividers, find the maximum sum of the water heights in each compartment.

The thickness of the partition can be ignored.



input

$ N \ M $
$ a_1 \ cdots a_N $

output

Output the maximum value of the total water height of each section in one line. Also, output a line break at the end. It is acceptable if the relative or absolute error is less than or equal to $ 10 ^ {-6} $.

Example

Input

5 3
9 1 2 3 9


Output

20.000000

Solution (in CPP):

Solution:
/*  -*- coding: utf-8 -*-
 *
 * 2877.cc: Aquarium
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 500;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N];
ll asums[MAX_N + 1];
double dp[MAX_N + 1][MAX_N + 1];

/* subroutines */

inline void setmax(double &a, double b) { if (a < b) a = b; }

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  asums[0] = 0;
  for (int i = 0; i < n; i++)
    scanf("%d", as + i), asums[i + 1] = asums[i] + as[i];

  for (int i = 0; i <= n; i++)
    fill(dp[i], dp[i] + m + 1, -1.0);
  dp[0][0] = 0.0;

  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (dp[i][j] >= 0.0)
	for (int k = i + 1; k <= n; k++) {
	  double d = dp[i][j] + (double)(asums[k] - asums[i]) / (k - i);
	  setmax(dp[k][j + 1], d);
	}

  printf("%.6lf\n", dp[n][m]);
  return 0;
}