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(double X = 0, double Y = 0) {
    x = X;
    y = Y;
  }
};
double v(point& a, point& b, point& c) {
  return (a.x - c.x) * (b.y - c.y) - (a.y - c.y) * (b.x - c.x);
}
bool cross_ll(point& a, point& b, point& c, point& d, double& k1, double& k2) {
  double z = (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x);
  double u1 = (d.x - c.x) * (a.y - c.y) - (d.y - c.y) * (a.x - c.x);
  double u2 = (b.x - a.x) * (a.y - c.y) - (b.y - a.y) * (a.x - c.x);
  if (z) {
    k1 = u1 / z;
    k2 = u2 / z;
    return true;
  } else
    return false;
}
const int H = 1111;
point t[H];
int td;
struct hull {
  int n;
  point d[H];
  hull() {
    n = 4;
    d[0] = d[4] = point(-1e5, -1e5);
    d[1] = point(-1e5, 1e5);
    d[2] = point(1e5, 1e5);
    d[3] = point(1e5, -1e5);
  }
  void add(point a, point b) {
    int i;
    for (i = 0; i < n; ++i)
      if (v(b, d[i], a) < 0) break;
    if (i == n) {
      n = 0;
      return;
    }
    for (i = 0; i < n; ++i)
      if (v(b, d[i], a) > 0 && v(b, d[i + 1], a) <= 0) break;
    if (i == n) return;
    td = 0;
    double k1, k2;
    cross_ll(a, b, d[i], d[i + 1], k1, k2);
    if (k2 < 1.0)
      t[td++] = point(d[i].x + (d[i + 1].x - d[i].x) * k2,
                      d[i].y + (d[i + 1].y - d[i].y) * k2);
    i = (i + 1) % n;
    while (v(b, d[i], a) <= 0) {
      t[td++] = d[i];
      i = (i + 1) % n;
    }
    i = (i - 1 + n) % n;
    cross_ll(a, b, d[i], d[i + 1], k1, k2);
    if (k2 > 0)
      t[td++] = point(d[i].x + (d[i + 1].x - d[i].x) * k2,
                      d[i].y + (d[i + 1].y - d[i].y) * k2);
    t[td] = t[0];
    for (n = td, i = 0; i <= n; ++i) d[i] = t[i];
  }
  void print() {
    int i;
    for (i = 0; i < n; ++i) cout << "(" << d[i].x << ',' << d[i].y << ") ";
    cout << endl;
  }
  double area() {
    point o;
    double s = 0;
    for (int i = 0; i < n; ++i) {
      s += v(d[i], d[(i + 1) % n], o);
    }
    return abs(s) / 2;
  }
};
const int N = 333;
int y[N][N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m + 1; ++j) scanf("%d", &y[i][j]);
  }
  for (int i = 0; i < n; ++i) {
    double ar = 0;
    for (int j = 0; j < m; ++j) {
      hull h;
      h.add(point(j + 1, 0), point(j, 0));
      h.add(point(j + 1, y[i][j + 1]), point(j + 1, 0));
      h.add(point(j, y[i][j]), point(j + 1, y[i][j + 1]));
      h.add(point(j, 0), point(j, y[i][j]));
      for (int k = 0; k < i; ++k) {
        h.add(point(j + 1, y[k][j + 1]), point(j, y[k][j]));
      }
      ar += h.area();
    }
    printf("%.12lf\n", ar);
  }
  return 0;
}