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;
double y[333][333];
double eps = 1e-5;
struct point {
  double x, y;
  point() {}
  point(double x, double y) {
    this->x = x;
    this->y = y;
  }
  bool operator==(const point &b) const {
    return fabs(x - b.x) < eps && fabs(y - b.y) < eps;
  }
  point operator-(const point &b) const { return point(x - b.x, y - b.y); }
  double operator*(const point &b) const { return x * b.y - y * b.x; }
};
struct line {
  point s, e;
  line(point a = point(), point b = point()) { s = a, e = b; }
  point operator&(const line &b) const {
    point res = s;
    double t = ((s - b.s) * (b.s - b.e)) / ((s - e) * (b.s - b.e));
    res.x += (e.x - s.x) * t;
    res.y += (e.y - s.y) * t;
    return res;
  }
};
line Q[353];
line Q2[353];
double area[333];
double xmult(point p1, point p2, point p0) {
  return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
}
int dots_inline(point p1, point p2, point p3) {
  return (((xmult(p1, p2, p3)) > 0 ? (xmult(p1, p2, p3))
                                   : -(xmult(p1, p2, p3))) < eps);
}
int same_side(point p1, point p2, line l) {
  return xmult(l.s, p1, l.e) * xmult(l.s, p2, l.e) > eps;
}
int dot_online_in(point p, line l) {
  return (((xmult(p, l.s, l.e)) > 0 ? (xmult(p, l.s, l.e))
                                    : -(xmult(p, l.s, l.e))) < eps) &&
         (l.s.x - p.x) * (l.e.x - p.x) < eps &&
         (l.s.y - p.y) * (l.e.y - p.y) < eps;
}
int intersect_in(line u, line v) {
  if (!dots_inline(u.s, u.e, v.s) || !dots_inline(u.s, u.e, v.e))
    return !same_side(u.s, u.e, v) && !same_side(v.s, v.e, u);
  return dot_online_in(u.s, v) || dot_online_in(u.e, v) ||
         dot_online_in(v.s, u) || dot_online_in(v.e, u);
}
point intersection(line u, line v) {
  point ret = u.s;
  double t =
      ((u.s.x - v.s.x) * (v.s.y - v.e.y) - (u.s.y - v.s.y) * (v.s.x - v.e.x)) /
      ((u.s.x - u.e.x) * (v.s.y - v.e.y) - (u.s.y - u.e.y) * (v.s.x - v.e.x));
  ret.x += (u.e.x - u.s.x) * t;
  ret.y += (u.e.y - u.s.y) * t;
  return ret;
}
double getarea(line Q[], int top) {
  double sum = 0;
  for (int j = 1; j <= top; j++) sum += xmult(point(0, 0), Q[j].s, Q[j].e);
  return fabs(sum);
}
int parallel(line u, line v) {
  return ((((u.s.x - u.e.x) * (v.s.y - v.e.y) -
            (v.s.x - v.e.x) * (u.s.y - u.e.y)) > 0
               ? ((u.s.x - u.e.x) * (v.s.y - v.e.y) -
                  (v.s.x - v.e.x) * (u.s.y - u.e.y))
               : -((u.s.x - u.e.x) * (v.s.y - v.e.y) -
                   (v.s.x - v.e.x) * (u.s.y - u.e.y))) < eps);
}
int main() {
  int n, K;
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= K; j++) scanf("%lf", &y[i][j]);
  for (int i = 0; i < K; i++) {
    int top = 0;
    Q[++top] = line(point(i, 100000), point(i, 0));
    Q[++top] = line(point(i, 0), point(i + 1, 0));
    Q[++top] = line(point(i + 1, 0), point(i + 1, 100000));
    Q[++top] = line(point(i + 1, 100000), point(i, 100000));
    double area1 = getarea(Q, top);
    --top;
    for (int j = 0; j < n; j++) {
      int up = 0;
      int top2 = 0;
      int fg = 0;
      point last;
      if (i == 1) {
        int st;
        st = 0;
      }
      for (int k = 1; k <= top; k++) {
        if (dot_online_in(Q[k].s,
                          line(point(i, y[j][i]), point(i + 1, y[j][i + 1]))) &&
            dot_online_in(Q[k].e,
                          line(point(i, y[j][i]), point(i + 1, y[j][i + 1])))) {
          Q2[++top2] = Q[k];
          fg = 1;
        } else if (up == 0 &&
                   intersect_in(Q[k], line(point(i, y[j][i]),
                                           point(i + 1, y[j][i + 1])))) {
          point temp = intersection(
              Q[k], line(point(i, y[j][i]), point(i + 1, y[j][i + 1])));
          if (temp == Q[k].e) {
            Q2[++top2] = Q[k];
            continue;
          }
          if (fg == 1 ||
              temp == Q[k].s && same_side(Q[k - 1].s, Q[k].e,
                                          line(point(i, y[j][i]),
                                               point(i + 1, y[j][i + 1])))) {
            Q2[++top2] = Q[k];
            fg = 0;
            continue;
          }
          if (temp == Q[k].s) {
          } else {
            Q2[++top2] = Q[k];
            Q2[top2].e = temp;
          }
          last = temp;
          up = 1;
        } else if (up == 1 &&
                   intersect_in(Q[k], line(point(i, y[j][i]),
                                           point(i + 1, y[j][i + 1])))) {
          point temp = intersection(
              Q[k], line(point(i, y[j][i]), point(i + 1, y[j][i + 1])));
          if (temp == Q[k].e) {
            continue;
          }
          Q2[++top2] = line(last, temp);
          Q2[++top2] = Q[k];
          Q2[top2].s = temp;
          up = -1;
        } else if (up <= 0)
          Q2[++top2] = Q[k];
      }
      Q2[++top2] = line(point(i + 1, 100000), point(i, 100000));
      double area2 = getarea(Q2, top2);
      if (area2 > area1) {
        int st;
        st = 0;
      }
      top2--;
      area[j] += area1 - area2;
      area1 = area2;
      top = top2;
      for (int k = 1; k <= top; k++) Q[k] = Q2[k];
    }
  }
  for (int i = 0; i < n; i++) printf("%.10f\n", area[i] / 2.0);
}