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;
int n, k, vet[602][602], cnt[602];
double lin[602][602][2], are[602];
bool lines_inter(double* p1, double* p2, double* p3, double* p4, double* r) {
  double d =
      (p1[0] - p2[0]) * (p3[1] - p4[1]) - (p1[1] - p2[1]) * (p3[0] - p4[0]);
  if (fabs(d) < 1e-7) return false;
  r[0] = ((p1[0] * p2[1] - p1[1] * p2[0]) * (p3[0] - p4[0]) -
          (p1[0] - p2[0]) * (p3[0] * p4[1] - p3[1] * p4[0])) /
         d;
  r[1] = ((p1[0] * p2[1] - p1[1] * p2[0]) * (p3[1] - p4[1]) -
          (p1[1] - p2[1]) * (p3[0] * p4[1] - p3[1] * p4[0])) /
         d;
  if (r[0] + 1e-7 < min(p1[0], p2[0]) || r[0] - 1e-7 > max(p1[0], p2[0]))
    return false;
  if (r[0] + 1e-7 < min(p3[0], p4[0]) || r[0] - 1e-7 > max(p3[0], p4[0]))
    return false;
  if (r[1] + 1e-7 < min(p1[1], p2[1]) || r[1] - 1e-7 > max(p1[1], p2[1]))
    return false;
  if (r[1] + 1e-7 < min(p3[1], p4[1]) || r[1] - 1e-7 > max(p3[1], p4[1]))
    return false;
  return true;
}
double area(double vet[602][2], int c) {
  double a = 0;
  for (int i = 0; i < c - 1; ++i) {
    a += 1.0 * (vet[i][1] + vet[i + 1][1]) * (vet[i + 1][0] - vet[i][0]) / 2;
  }
  return a;
}
bool istop(double a1, double b1, double a2, double b2) {
  if (fabs(a1 - b1) < 1e-7) {
    return a2 > b2;
  }
  return a1 > b1;
}
void norm(double tmp[602][2], int& c) {
  while (c > 2) {
    bool g = 0;
    if (c > 1) {
      if (fabs(tmp[c - 1][0] - tmp[c - 2][0]) < 1e-7 &&
          fabs(tmp[c - 1][1] - tmp[c - 2][1]) < 1e-7) {
        g = 1;
        --c;
      }
    }
    if (c > 2) {
      double dx1 = tmp[c - 1][0] - tmp[c - 2][0];
      double dx2 = tmp[c - 2][0] - tmp[c - 3][0];
      double dy1 = tmp[c - 1][1] - tmp[c - 2][1];
      double dy2 = tmp[c - 2][1] - tmp[c - 3][1];
      if (fabs(dy1 / dx1 - dy2 / dx2) < 1e-7) {
        g = 1;
        tmp[c - 2][0] = tmp[c - 1][0];
        tmp[c - 2][1] = tmp[c - 1][1];
        --c;
      }
    }
    if (!g) break;
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= k; ++j) scanf("%d", vet[i] + j);
  for (int i = 0; i < k; ++i)
    cnt[i] = 2, lin[i][0][0] = i, lin[i][0][1] = 0, lin[i][1][0] = i + 1,
    lin[i][1][1] = 0;
  for (int i = 0; i < n; ++i) {
    double res = 0;
    for (int j = 0; j < k; ++j) {
      int c = 0;
      double tmp[602][2], A1[2], A2[2], aux[2];
      double dy = vet[i][j + 1] - vet[i][j];
      A1[0] = j;
      A1[1] = vet[i][j];
      A2[0] = j + 1;
      A2[1] = vet[i][j + 1];
      for (int p = 0; p < cnt[j] - 1; ++p) {
        double x = lin[j][p][0];
        double y = vet[i][j] + dy * (x - j);
        tmp[c][0] = x;
        tmp[c][1] = max(lin[j][p][1], y);
        ++c;
        norm(tmp, c);
        if (lines_inter(A1, A2, lin[j][p], lin[j][p + 1], aux)) {
          if (fabs(aux[0] - x) > 1e-7 &&
              fabs(aux[0] - lin[j][p + 1][0]) > 1e-7) {
            tmp[c][0] = aux[0];
            tmp[c][1] = aux[1];
            ++c;
            norm(tmp, c);
          }
        }
        x = lin[j][p + 1][0];
        y = vet[i][j] + dy * (x - j);
        tmp[c][0] = x;
        tmp[c][1] = max(lin[j][p + 1][1], y);
        ++c;
        norm(tmp, c);
      }
      double a = area(tmp, c);
      res += a - are[j];
      are[j] = a;
      cnt[j] = c;
      for (int z = 0; z < c; ++z)
        lin[j][z][0] = tmp[z][0], lin[j][z][1] = tmp[z][1];
    }
    printf("%.6lf\n", res);
  }
}