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;
typedef struct point {
  double x;
  double y;
  point(const double &x1 = 0, const double &y1 = 0) {
    x = x1;
    y = y1;
  }
} point;
typedef struct line {
  point p1;
  point p2;
  line(const point &s = point(), const point &t = point()) {
    p1 = s;
    p2 = t;
  }
} line;
typedef struct circle {
  point p;
  double r;
  circle(const point &p1 = point(), const double &r1 = 0) {
    p = p1;
    r = r1;
  }
} circle;
double eps = 1e-8;
bool operator<(const point &a, const point &b) {
  if (abs(a.x - b.x) > eps) return a.x < b.x;
  return a.y < b.y;
}
bool operator==(const point &a, const point &b) {
  return abs(a.x - b.x) < eps && abs(a.y - b.y) < eps;
}
point operator+(const point &a, const point &b) {
  return point(a.x + b.x, a.y + b.y);
}
point operator-(const point &a, const point &b) {
  return point(a.x - b.x, a.y - b.y);
}
point operator*(const point &a, const double &r) {
  return point(a.x * r, a.y * r);
}
point operator/(const point &a, const double &r) {
  return point(a.x / r, a.y / r);
}
inline double area(const point &p1, const point &p2, const point &p3) {
  point p = p1 - p3;
  point q = p2 - p3;
  return abs(p.x * q.y - p.y * q.x) / 2;
}
inline point cross_point(const line &l1, const line &l2) {
  double a = area(l1.p1, l2.p1, l2.p2);
  double b = area(l1.p2, l2.p1, l2.p2);
  if (a < eps && b < eps) return l1.p1;
  return l1.p1 + (l1.p2 - l1.p1) * a / (a + b);
}
int main() {
  int n, k, i, j, l;
  double eps = 1e-8;
  int a[300][301];
  double ans[300] = {0};
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    for (j = 0; j <= k; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (i = 0; i < k; i++) {
    vector<point> v;
    ans[0] += (a[0][i] + a[0][i + 1]) / 2.0;
    v.push_back(point(0, a[0][i]));
    v.push_back(point(1, a[0][i + 1]));
    for (j = 1; j < n; j++) {
      vector<point> w;
      for (l = 0; l + 1 < v.size(); l++) {
        double y1 = a[j][i] + (a[j][i + 1] - a[j][i]) * v[l].x;
        double y2 = a[j][i] + (a[j][i + 1] - a[j][i]) * v[l + 1].x;
        if (y1 + eps >= v[l].y && y2 + eps >= v[l + 1].y) {
          ans[j] += (y1 + y2) / 2 * (v[l + 1].x - v[l].x);
          ans[j] -= (v[l].y + v[l + 1].y) / 2 * (v[l + 1].x - v[l].x);
        } else if (y1 + eps >= v[l].y || y2 + eps >= v[l + 1].y) {
          point p = cross_point(line(point(v[l].x, y1), point(v[l + 1].x, y2)),
                                line(v[l], v[l + 1]));
          if (y1 + eps >= v[l].y) {
            ans[j] += (y1 + p.y) / 2 * (p.x - v[l].x);
            ans[j] -= (v[l].y + p.y) / 2 * (p.x - v[l].x);
          } else {
            ans[j] += (y2 + p.y) / 2 * (v[l + 1].x - p.x);
            ans[j] -= (v[l + 1].y + p.y) / 2 * (v[l + 1].x - p.x);
          }
        }
      }
      if (a[j][i] >= v[0].y) {
        w.push_back(point(0, a[j][i]));
        for (l = 1; l < v.size(); l++) {
          double y = a[j][i] + (a[j][i + 1] - a[j][i]) * v[l].x;
          if (v[l].y > y + eps) {
            point p =
                cross_point(line(point(0, a[j][i]), point(1, a[j][i + 1])),
                            line(v[l - 1], v[l]));
            w.push_back(p);
            break;
          }
        }
        if (l == v.size()) {
          w.push_back(point(1, a[j][i + 1]));
          v = w;
          continue;
        }
        for (; l < v.size(); l++) w.push_back(v[l]);
      } else {
        for (l = 0; l < v.size(); l++) {
          double y = a[j][i] + (a[j][i + 1] - a[j][i]) * v[l].x;
          if (y > v[l].y + eps) {
            point p =
                cross_point(line(point(0, a[j][i]), point(1, a[j][i + 1])),
                            line(v[l - 1], v[l]));
            if (abs(p.x - v[l - 1].x) > eps) w.push_back(p);
            break;
          }
          w.push_back(v[l]);
        }
        for (; l < v.size(); l++) {
          double y = a[j][i] + (a[j][i + 1] - a[j][i]) * v[l].x;
          if (v[l].y > y + eps) {
            point p =
                cross_point(line(point(0, a[j][i]), point(1, a[j][i + 1])),
                            line(v[l - 1], v[l]));
            w.push_back(p);
            break;
          }
        }
        if (l == v.size()) {
          w.push_back(point(1, a[j][i + 1]));
          v = w;
          continue;
        }
        for (; l < v.size(); l++) w.push_back(v[l]);
      }
      v = w;
    }
  }
  for (i = 0; i < n; i++) printf("%.12lf\n", ans[i]);
  return 0;
}