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>
int n, k;
int sts[301][301];
typedef struct {
  double x;
  double y;
} shps;
int ln[301];
shps shp[301][301];
shps nw[301];
double ksol[301];
double EPS = 0.000000001;
double calc(double a, double b, double c) { return a + (b - a) * c; }
double calcx(double a, double b, double c, double d) {
  return (c - a) / (c - d - a + b);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      scanf("%d", &sts[i][j]);
    }
  }
  for (int i = 0; i <= k; i++) {
    ln[i] = 2;
    shp[i][0].x = 0;
    shp[i][1].x = 1;
    shp[i][0].y = 0;
    shp[i][1].y = 0;
  }
  for (int i = 0; i < n; i++) {
    ksol[i] = 0;
    for (int j = 0; j < k; j++) {
      double st = -1;
      double ed = -1;
      for (int t = 0; t < ln[j] - 1; t++) {
        if (calc(sts[i][j], sts[i][j + 1], shp[j][t].x) > shp[j][t].y + EPS) {
          st = shp[j][t].x;
          break;
        } else {
          if (calc(sts[i][j], sts[i][j + 1], shp[j][t + 1].x) >
              shp[j][t + 1].y + EPS) {
            double tx = calcx(calc(sts[i][j], sts[i][j + 1], shp[j][t].x),
                              calc(sts[i][j], sts[i][j + 1], shp[j][t + 1].x),
                              shp[j][t].y, shp[j][t + 1].y);
            st = shp[j][t].x + (shp[j][t + 1].x - shp[j][t].x) * tx;
            break;
          }
        }
      }
      for (int t = ln[j] - 2; t >= 0; t--) {
        if (calc(sts[i][j], sts[i][j + 1], shp[j][t + 1].x) >
            shp[j][t + 1].y + EPS) {
          ed = shp[j][t + 1].x;
          break;
        } else {
          if (calc(sts[i][j], sts[i][j + 1], shp[j][t].x) > shp[j][t].y + EPS) {
            double tx = calcx(calc(sts[i][j], sts[i][j + 1], shp[j][t].x),
                              calc(sts[i][j], sts[i][j + 1], shp[j][t + 1].x),
                              shp[j][t].y, shp[j][t + 1].y);
            ed = shp[j][t].x + (shp[j][t + 1].x - shp[j][t].x) * tx;
            break;
          }
        }
      }
      if (st > -EPS) {
        int nln = 0;
        for (int t = 0; t < ln[j]; t++) {
          if (shp[j][t].x < st - EPS) {
            nw[nln].x = shp[j][t].x;
            nw[nln].y = shp[j][t].y;
            nln++;
          }
        }
        nw[nln].x = st;
        nw[nln].y = calc(sts[i][j], sts[i][j + 1], st);
        nln++;
        nw[nln].x = ed;
        nw[nln].y = calc(sts[i][j], sts[i][j + 1], ed);
        nln++;
        for (int t = 0; t < ln[j]; t++) {
          if (shp[j][t].x > ed + EPS) {
            nw[nln].x = shp[j][t].x;
            nw[nln].y = shp[j][t].y;
            nln++;
          }
        }
        ln[j] = nln;
        for (int t = 0; t < nln; t++) {
          shp[j][t].x = nw[t].x;
          shp[j][t].y = nw[t].y;
        }
      }
      for (int t = 0; t < ln[j] - 1; t++) {
        ksol[i] += (shp[j][t].y + shp[j][t + 1].y) *
                   (shp[j][t + 1].x - shp[j][t].x) / 2;
      }
    }
  }
  printf("%.9f\n", ksol[0]);
  for (int i = 1; i < n; i++) printf("%.9f\n", ksol[i] - ksol[i - 1]);
  return 0;
}