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;
const double EPS = 1E-9;
struct pt {
  double x, y;
  bool operator<(const pt& p) const {
    return x < p.x - EPS || abs(x - p.x) < EPS && y < p.y - EPS;
  }
};
struct line {
  double a, b, c;
  line() {}
  line(pt p, pt q) {
    a = p.y - q.y;
    b = q.x - p.x;
    c = -a * p.x - b * p.y;
    norm();
  }
  void norm() {
    double z = sqrt(a * a + b * b);
    if (abs(z) > EPS) a /= z, b /= z, c /= z;
  }
  double dist(pt p) const { return a * p.x + b * p.y + c; }
};
inline bool betw(double l, double r, double x) {
  return min(l, r) <= x + EPS && x <= max(l, r) + EPS;
}
inline bool intersect_1d(double a, double b, double c, double d) {
  if (a > b) swap(a, b);
  if (c > d) swap(c, d);
  return max(a, c) <= min(b, d) + EPS;
}
bool intersect(pt a, pt b, pt c, pt d, pt& left, pt& right) {
  if (!intersect_1d(a.x, b.x, c.x, d.x) || !intersect_1d(a.y, b.y, c.y, d.y))
    return false;
  line m(a, b);
  line n(c, d);
  double zn = (m.a * n.b - m.b * n.a);
  if (abs(zn) < EPS) {
    if (abs(m.dist(c)) > EPS || abs(n.dist(a)) > EPS) return false;
    if (b < a) swap(a, b);
    if (d < c) swap(c, d);
    left = max(a, c);
    right = min(b, d);
    return true;
  } else {
    left.x = right.x = -(m.c * n.b - m.b * n.c) / zn;
    left.y = right.y = -(m.a * n.c - m.c * n.a) / zn;
    return betw(a.x, b.x, left.x) && betw(a.y, b.y, left.y) &&
           betw(c.x, d.x, left.x) && betw(c.y, d.y, left.y);
  }
}
int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  static int data[305][305];
  int i, j;
  for (i = 0; i < N; i++) {
    for (j = 0; j <= K; j++) {
      scanf("%d", &(data[i][j]));
    }
  }
  static double res[305];
  for (i = 0; i < N; i++) res[i] = 0.0;
  static struct pt a[305 * 305];
  int ac;
  static struct pt b[305 * 305];
  int bc;
  int q;
  double width;
  pt A, B, C, D, LEFT, RIGHT;
  bool inter;
  for (i = 0; i < K; i++) {
    ac = 2;
    a[0].x = 0.0;
    a[0].y = (double)(data[0][i]);
    a[1].x = 1.0;
    a[1].y = (double)(data[0][i + 1]);
    res[0] += ((a[0].y + a[1].y) / 2.0);
    for (j = 1; j < N; j++) {
      bc = 1;
      b[0].x = a[0].x;
      b[0].y = a[0].y;
      if ((double)(data[j][i]) > b[0].y) b[0].y = (double)(data[j][i]);
      for (q = 0; q < (ac - 1); q++) {
        width = a[q + 1].x - a[q].x;
        A.x = a[q].x;
        A.y = a[q].y;
        B.x = a[q + 1].x;
        B.y = a[q + 1].y;
        C.x = a[q].x;
        C.y = (double)(data[j][i]) +
              a[q].x * (double)(data[j][i + 1] - data[j][i]);
        D.x = a[q + 1].x;
        D.y = (double)(data[j][i]) +
              a[q + 1].x * (double)(data[j][i + 1] - data[j][i]);
        inter = intersect(A, B, C, D, LEFT, RIGHT);
        if ((inter) && (!((LEFT < RIGHT) || (RIGHT < LEFT)))) {
          double S;
          S = ((LEFT.x - A.x) * (C.y - A.y)) / 2.0;
          if (S > 0.0) res[j] += S;
          S = ((D.x - LEFT.x) * (D.y - B.y)) / 2.0;
          if (S > 0.0) res[j] += S;
          b[bc].x = LEFT.x;
          b[bc].y = LEFT.y;
          bc++;
        } else {
          double S = width * (((C.y + D.y) / 2.0) - ((A.y + B.y) / 2.0));
          if (S > 0.0) res[j] += S;
        }
        b[bc].x = a[q + 1].x;
        b[bc].y = a[q + 1].y;
        if (D.y > b[bc].y) b[bc].y = D.y;
        bc++;
      }
      a[0] = b[0];
      ac = 1;
      for (q = 1; q < (bc - 1); q++) {
        if ((b[q].x < 1.0) && (fabs(b[q].x - b[q - 1].x) >= EPS)) {
          a[ac] = b[q];
          ac++;
        }
      }
      a[ac] = b[bc - 1];
      ac++;
    }
  }
  for (i = 0; i < N; i++) {
    printf("%.9lf\n", (double)(res[i]));
  }
  return 0;
}