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>
#pragma GCC optimize(3)
using namespace std;
const double eps = 1e-7;
struct point {
  double x, y;
  point(double X, double Y) : x(X), y(Y) {}
  point operator-(point other) const { return point(x - other.x, y - other.y); }
  point operator+(point other) const { return point(x + other.x, y + other.y); }
  point operator*(double t) const { return point(x * t, y * t); }
};
int sgn(double x) {
  if (fabs(x) <= eps) return 0;
  if (x > 0) return 1;
  return -1;
}
double Cross(point A, point B) { return A.x * B.y - A.y * B.x; }
double ycoord(double x, point p1, point p2) {
  return p1.y + (x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x);
}
point GetLineIntersection(point P, point v, point Q, point w) {
  point u = P - Q;
  double t = Cross(w, u) / Cross(v, w);
  return P + v * t;
}
vector<point> outline;
vector<bool> cancel;
vector<point> curr;
double ans[411];
int coord[411][411];
int n;
vector<point> merge(vector<point> &pt1, vector<point> &pt2) {
  int i = 0, j = 0;
  vector<point> ret;
  int sz1 = pt1.size(), sz2 = pt2.size();
  while (i < sz1 && j < sz2) {
    if (pt1[i].x <= pt2[j].x) {
      if (ret.empty() || sgn(ret.back().x - pt1[i].x) != 0 ||
          sgn(ret.back().y - pt1[i].y) != 0) {
        ret.push_back(pt1[i]);
      }
      ++i;
    } else {
      if (ret.empty() || sgn(ret.back().x - pt2[j].x) != 0 ||
          sgn(ret.back().y - pt2[j].y) != 0) {
        ret.push_back(pt2[j]);
      }
      ++j;
    }
  }
  while (i < sz1) {
    if (ret.empty() || sgn(ret.back().x - pt1[i].x) != 0 ||
        sgn(ret.back().y - pt1[i].y) != 0) {
      ret.push_back(pt1[i]);
    }
    ++i;
  }
  while (j < sz2) {
    if (ret.empty() || sgn(ret.back().x - pt2[j].x) != 0 ||
        sgn(ret.back().y - pt2[j].y) != 0) {
      ret.push_back(pt2[j]);
    }
    ret.push_back(pt2[j++]);
  }
  return ret;
}
void solve(int l) {
  int i, j;
  outline.clear();
  outline.push_back(point(l, coord[1][l]));
  outline.push_back(point(l + 1, coord[1][l + 1]));
  ans[1] += 0.5 * (coord[1][l] + coord[1][l + 1]);
  for (i = 2; i <= n; ++i) {
    point L = point(l, coord[i][l]), R = point(l + 1, coord[i][l + 1]);
    int sz = (int)outline.size();
    curr.clear();
    cancel = vector<bool>(sz, false);
    for (j = 0; j < sz - 1; ++j) {
      double y1 = ycoord(outline[j].x, L, R),
             y2 = ycoord(outline[j + 1].x, L, R);
      double d1 = -outline[j].y + y1, d2 = -outline[j + 1].y + y2;
      if (sgn(d1) >= 0 && sgn(d2) >= 0) {
        cancel[j] = true, cancel[j + 1] = true;
        ans[i] += 0.5 * (d1 + d2) * (outline[j + 1].x - outline[j].x);
        curr.push_back(point(outline[j].x, y1));
        curr.push_back(point(outline[j + 1].x, y2));
      } else if (sgn(d1) > 0 && sgn(d2) < 0) {
        point pt = GetLineIntersection(L, R - L, outline[j],
                                       outline[j + 1] - outline[j]);
        cancel[j] = true;
        ans[i] += 0.5 * (pt.x - outline[j].x) * d1;
        curr.push_back(point(outline[j].x, y1));
        curr.push_back(pt);
      } else if (sgn(d1) < 0 && sgn(d2) > 0) {
        point pt = GetLineIntersection(L, R - L, outline[j],
                                       outline[j + 1] - outline[j]);
        cancel[j + 1] = true;
        ans[i] += 0.5 * (outline[j + 1].x - pt.x) * d2;
        curr.push_back(pt);
        curr.push_back(point(outline[j + 1].x, y2));
      }
    }
    vector<point> tmp;
    for (j = 0; j < sz; ++j) {
      if (!cancel[j]) tmp.push_back(outline[j]);
    }
    outline = merge(tmp, curr);
  }
}
int main() {
  int k, i, j;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; ++i) {
    for (j = 0; j <= k; ++j) {
      scanf("%d", &coord[i][j]);
    }
  }
  for (i = 0; i < k; ++i) {
    solve(i);
  }
  for (i = 1; i <= n; ++i) {
    printf("%.12lf\n", fabs(ans[i]));
  }
  return 0;
}