Problem: Due to atheistic Soviet past, Christmas wasn't officially celebrated in Russia for most of the twentieth century. As a result, the Russian traditions for Christmas and New Year mixed into one event celebrated on the New Year but including the tree, a Santa-like 'Grandfather Frost', presents and huge family reunions and dinner parties all over the country. Bying a Tree at the New Year and installing it in the house is a tradition. Usually the whole family decorates the tree on the New Year Eve. We hope that Codeforces is a big and loving family, so in this problem we are going to decorate a tree as well.

So, our decoration consists of n pieces, each piece is a piece of colored paper, its border is a closed polyline of a special shape. The pieces go one by one as is shown on the picture. The i-th piece is a polyline that goes through points: (0, 0), (0, y0), (1, y1), (2, y2), ..., (k, yk), (k, 0). The width of each piece equals k.

<image> The figure to the left shows the decoration, the figure to the right shows the individual pieces it consists of.

The piece number 1 (shown red on the figure) is the outer piece (we see it completely), piece number 2 (shown yellow) follows it (we don't see it completely as it is partially closed by the first piece) and so on. The programmers are quite curious guys, so the moment we hung a decoration on the New Year tree we started to wonder: what area of each piece can people see?

Input

The first line contains two integers, n and k (1 ≤ n, k ≤ 300). Each of the following n lines contains k + 1 integers — the description of the polyline. If the i-th line contains ontegers yi, 0, yi, 1, ..., yi, k, that means that the polyline of the i-th piece goes through points (0, 0), (0, yi, 0), (1, yi, 1), (2, yi, 2), ..., (k, yi, k), (k, 0) (1 ≤ yi, j ≤ 1000).

Output

Print n real numbers — for each polyline, the area of its visible part.

The answer will be considered correct if its relative or absolute error do not exceed 10 - 4. 

Examples

Input

2 2
2 1 2
1 2 1


Output

3.000000000000
0.500000000000


Input

1 1
1 1


Output

1.000000000000


Input

4 1
2 7
7 2
5 5
6 4


Output

4.500000000000
1.250000000000
0.050000000000
0.016666666667

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
string ToString(T t) {
  stringstream s;
  s << t;
  return s.str();
}
template <class T>
void ToOther(T &t, string a) {
  stringstream s(a);
  s >> t;
}
int n, k;
bool ck = 0;
vector<pair<double, double> > now, nxt;
double Pos(pair<double, double> s, pair<double, double> e, double x) {
  double dx = x - s.first;
  double t = s.second + (e.second - s.second) * dx / (e.first + s.first);
  return s.second + (e.second - s.second) * dx / (e.first - s.first);
}
pair<double, double> Get(double s, double e, pair<double, double> a,
                         pair<double, double> b) {
  return pair<double, double>(Pos(a, b, s), Pos(a, b, e));
}
double Area(double s, double e, pair<double, double> up) {
  return (up.first + up.second) * (e - s) / 2;
}
double cross(pair<double, double> a, pair<double, double> b,
             pair<double, double> c) {
  b.first -= a.first;
  b.second -= a.second;
  c.first -= a.first;
  c.second -= a.second;
  return ((double)b.first * c.second) - ((double)b.second * c.first);
}
double check(pair<double, double> aa1, pair<double, double> aa2,
             pair<double, double> bb1, pair<double, double> bb2) {
  pair<double, double> a[2];
  a[0] = aa1;
  a[1] = bb1;
  pair<double, double> b[2];
  b[0] = aa2;
  b[1] = bb2;
  double a1, a2;
  int x = 0, y = 1;
  a1 = cross(a[x], b[x], a[y]);
  if (a1 == 0 && min(a[x].first, b[x].first) <= a[y].first &&
      a[y].first <= max(a[x].first, b[x].first) &&
      min(a[x].second, b[x].second) <= a[y].second &&
      a[y].second <= max(a[x].second, b[x].second))
    ck = 1;
  a2 = cross(a[x], b[x], b[y]);
  if (a2 == 0 && min(a[x].first, b[x].first) <= b[y].first &&
      b[y].first <= max(a[x].first, b[x].first) &&
      min(a[x].second, b[x].second) <= b[y].second &&
      b[y].second <= max(a[x].second, b[x].second))
    ck = 1;
  return a1 * a2;
}
bool same(pair<double, double> a, pair<double, double> b) {
  return ((a.first - b.first) < 0 ? (-(a.first - b.first))
                                  : (a.first - b.first)) < 1e-9 &&
         ((a.second - b.second) < 0 ? (-(a.second - b.second))
                                    : (a.second - b.second)) < 1e-9;
}
void cross(pair<double, double> a1, pair<double, double> a2,
           pair<double, double> b1, pair<double, double> b2,
           pair<double, double> &point) {
  ck = 0;
  double p = check(a1, a2, b1, b2);
  double q = check(b1, b2, a1, a2);
  if ((p < 1e-9 && q < 1e-9) || ck) {
    double s = a1.first - 5.0;
    double e = a2.first + 5.0;
    for (int i = 0; i < 100; i++) {
      double m1 = (s + s + e) / 3;
      double m2 = (s + e + e) / 3;
      double dis1 = ((Pos(a1, a2, m1) - Pos(b1, b2, m1)) < 0
                         ? (-(Pos(a1, a2, m1) - Pos(b1, b2, m1)))
                         : (Pos(a1, a2, m1) - Pos(b1, b2, m1)));
      double dis2 = ((Pos(a1, a2, m2) - Pos(b1, b2, m2)) < 0
                         ? (-(Pos(a1, a2, m2) - Pos(b1, b2, m2)))
                         : (Pos(a1, a2, m2) - Pos(b1, b2, m2)));
      if (dis1 > dis2)
        s = m1;
      else
        e = m2;
    }
    point.first = e;
    point.second = Pos(a1, a2, e);
  }
  if (same(a1, point) || same(a2, point) || same(b1, point) || same(b2, point))
    point.first = 1e100;
  if (a1.first <= point.first && point.first <= a2.first &&
      b1.first <= point.first && point.first <= b2.first)
    return;
  point.first = 1e100;
}
double calc2(pair<double, double> a1, pair<double, double> a2,
             pair<double, double> b1, pair<double, double> b2,
             pair<double, double> &point) {
  double s = max(a1.first, b1.first);
  double e = min(a2.first, b2.first);
  pair<double, double> upa = Get(s, e, a1, a2);
  pair<double, double> upb = Get(s, e, b1, b2);
  if (((upa.first - upb.first) < 0 ? (-(upa.first - upb.first))
                                   : (upa.first - upb.first)) < 1e-9 &&
      ((upa.second - upb.second) < 0 ? (-(upa.second - upb.second))
                                     : (upa.second - upb.second)) < 1e-9)
    return 0.0;
  point = make_pair(1e100, 1e100);
  cross(a1, a2, b1, b2, point);
  if (point.first >= 1e50) {
    pair<double, double> upa = Get(s, e, a1, a2);
    pair<double, double> upb = Get(s, e, b1, b2);
    double sa = Area(s, e, upa);
    double sb = Area(s, e, upb);
    return max(0.0, sb - sa);
  } else {
    pair<double, double> dummy;
    return calc2(a1, point, b1, point, dummy) +
           calc2(point, a2, point, b2, dummy);
  }
}
double calc(vector<pair<double, double> > &A, vector<pair<double, double> > &B,
            vector<pair<double, double> > &C) {
  int posA = 0;
  int posB = 0;
  double r = 0.0;
  C.push_back(pair<double, double>(0, max(A[0].second, B[0].second)));
  for (int i = 1; i < A.size(); i++) {
    while (posB < B.size() && B[posB].first + 1e-9 < A[i].first) posB++;
    pair<double, double> point = pair<double, double>(1e100, 1e100);
    r += calc2(A[i - 1], A[i], B[posB - 1], B[posB], point);
    if (point.first <= 1e50) C.push_back(point);
    double t = A[i].first;
    C.push_back(pair<double, double>(
        t, max(Pos(A[i - 1], A[i], t), Pos(B[posB - 1], B[posB], t))));
  }
  return r;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= k; i++) now.push_back(pair<double, double>(i, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      int t;
      scanf("%d", &t);
      nxt.push_back(pair<double, double>(j, t));
    }
    vector<pair<double, double> > temp;
    double r = calc(now, nxt, temp);
    printf("%.10lf\n", r);
    now = temp;
    nxt.clear();
  }
}