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;
struct point {
  double x, y;
  point() {
    x = 0;
    y = 0;
  }
  point(double a, double b) : x(a), y(b) {}
  bool operator<(const point &rhs) const { return x < rhs.x; }
};
bool equal(point a, point b) {
  return abs(a.x - b.x) < 1e-9 && abs(a.y - b.y) < 1e-9;
}
struct Line {
  point p1, p2;
  double A, B, C;
  Line() {}
  Line(double xx1, double yy1, double xx2, double yy2) {
    p1 = point(xx1, yy1), p2 = point(xx2, yy2);
    A = p1.y - p2.y, B = p2.x - p1.x, C = -(A * p1.x + B * p1.y);
  }
  Line(point t1, point t2) {
    p1 = t1, p2 = t2;
    A = p1.y - p2.y, B = p2.x - p1.x, C = -(A * p1.x + B * p1.y);
  }
  double getY(double x) { return (-C - A * x) / B; }
};
bool is_in_line_seg(double x, double y, Line LL) {
  if (!(min(LL.p1.x, LL.p2.x) - 1e-9 <= x &&
        x <= max(LL.p1.x, LL.p2.x) + 1e-9 &&
        min(LL.p1.y, LL.p2.y) - 1e-9 <= y && y <= max(LL.p1.y, LL.p2.y) + 1e-9))
    return false;
  return abs(LL.A * x + LL.B * y + LL.C) < 1e-9;
}
bool intersection_line_line(Line L1, Line L2, point &p) {
  double det = L1.A * L2.B - L2.A * L1.B;
  if (abs(det) < 1e-9) return 0;
  p.x = -(L2.B * L1.C - L1.B * L2.C) / det;
  p.y = -(L1.A * L2.C - L2.A * L1.C) / det;
  return 1;
}
double calc(vector<point> &v) {
  double ret = 0;
  int n = v.size();
  for (int i = 0; i < n; ++i) {
    ret += v[i].x * v[(i + 1) % n].y - v[(i + 1) % n].x * v[i].y;
  }
  return abs(ret) / 2.0;
}
int n, k;
Line L[333][333];
vector<point> v[333];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    double p1, p2;
    cin >> p1;
    for (int j = 0; j < k; ++j) {
      cin >> p2;
      L[i][j] = Line(j, p1, j + 1, p2);
      p1 = p2;
    }
  }
  for (int j = 0; j < k; ++j)
    v[j].push_back(point(j, 2000)), v[j].push_back(point(j, 0)),
        v[j].push_back(point(j + 1, 0)), v[j].push_back(point(j + 1, 2000));
  for (int i = 0; i < n; ++i) {
    double ans = 0;
    printf("");
    for (int j = 0; j < k; ++j) {
      vector<point> nv;
      vector<point> tmp;
      Line cur = L[i][j];
      nv.push_back(point(j, 2000));
      bool in = 0;
      for (int t = 0; t < (int)v[j].size() - 1; ++t) {
        point p1 = v[j][t];
        point p2 = v[j][t + 1];
        Line len = Line(p1, p2);
        point inter;
        if (!intersection_line_line(cur, len, inter) ||
            !is_in_line_seg(inter.x, inter.y, len) || equal(p1, inter)) {
          if (in) tmp.push_back(p2);
          continue;
        }
        nv.push_back(inter);
        if (!in) {
          tmp.clear(), in = 1;
          tmp.push_back(inter);
          tmp.push_back(p2);
        } else {
          tmp.push_back(inter);
          ans += calc(tmp);
          tmp.clear();
          in = 0;
        }
      }
      for (int t = 1; t < (int)v[j].size() - 1; ++t) {
        double yy = cur.getY(v[j][t].x);
        if (yy > v[j][t].y + 1e-9) continue;
        if (!equal(nv.back(), v[j][t])) nv.push_back(v[j][t]);
      }
      sort(nv.begin() + 1, nv.end());
      nv.push_back(point(j + 1, 2000));
      v[j] = nv;
    }
    printf("%.10lf\n", ans);
  }
}