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 int INF = 0x3f3f3f3f;
const double EPS = 1e-11;
const int MAXN = 333;
int N, K;
double first[MAXN];
struct pt {
  double x, y;
  pt() {}
  pt(double a, double b) : x(a), y(b) {}
  double cross(const pt that) const { return x * that.y - y * that.x; }
  pt operator-(const pt that) const { return pt(x - that.x, y - that.y); }
};
pt Y[MAXN][MAXN];
struct line {
  pt a, b;
  line() {}
  line(pt a, pt b) : a(a), b(b) {}
  double slope() const { return (b.y - a.y) / (b.x - a.x); }
  double at(double x) const { return a.y + slope() * (x - a.x); }
};
bool intersect(const line& a, const line& b) {
  pt x = a.b - a.a, y = b.b - a.a;
  double c1 = x.cross(y);
  y = b.a - a.a;
  double c2 = x.cross(y);
  x = b.b - b.a;
  y = a.b - b.a;
  double c3 = x.cross(y);
  y = a.a - b.a;
  double c4 = x.cross(y);
  return (c1 * c2 <= 0 && c3 * c4 <= 0);
}
double get_x(const line& a, const line& b) {
  double ma = a.slope();
  double mb = b.slope();
  double ba = -ma * a.a.x + a.a.y;
  double bb = -mb * b.a.x + b.a.y;
  return (bb - ba) / (ma - mb);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(9) << fixed;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      Y[i][j].x = j;
      cin >> Y[i][j].y;
    }
  }
  for (int i = 0; i < K; i++) {
    vector<pt> hull;
    hull.push_back(pt(i, 0));
    hull.push_back(pt(i + 1, 0));
    for (int j = 0; j < N; j++) {
      double cur = 0;
      int over = -1, under = -1;
      line back(Y[j][i], Y[j][i + 1]);
      for (int k = 0; k + 1 < hull.size(); k++) {
        line front(hull[k], hull[k + 1]);
        if (intersect(front, back)) {
          double x = get_x(front, back);
          if (front.slope() + EPS < back.slope()) {
            cur += .5 * (front.b.x - x) *
                   (back.at(front.b.x) - front.at(front.b.x));
            over = k;
          } else if (front.slope() > back.slope() + EPS) {
            cur += .5 * (x - front.a.x) *
                   (back.at(front.a.x) - front.at(front.a.x));
            under = k;
          }
        } else {
          if (back.at((front.a.x + front.b.x) / 2) >
              front.at((front.a.x + front.b.x) / 2)) {
            cur += (front.b.x - front.a.x) * .5 *
                   ((back.at(front.a.x) + back.at(front.b.x)) -
                    (front.at(front.a.x) + front.at(front.b.x)));
          }
        }
      }
      if (cur <= EPS) continue;
      first[j] += cur;
      vector<pt> newhull;
      if (over != -1) {
        for (int k = 0; k <= over; k++) newhull.push_back(hull[k]);
        line front(hull[over], hull[over + 1]);
        double x = get_x(front, back);
        if (x - newhull.back().x > EPS) newhull.push_back(pt(x, front.at(x)));
        if (under != -1) {
          front = line(hull[under], hull[under + 1]);
          double x = get_x(front, back);
          if (x - newhull.back().x > EPS) newhull.push_back(pt(x, front.at(x)));
          for (int i = under + 1; i < hull.size(); i++) {
            if (hull[i].x - newhull.back().x > EPS) newhull.push_back(hull[i]);
          }
        } else {
          pt p(back.b.x, back.b.y);
          if (p.x - newhull.back().x > EPS) newhull.push_back(p);
        }
      } else if (under != -1) {
        newhull.push_back(back.a);
        line front = line(hull[under], hull[under + 1]);
        double x = get_x(front, back);
        if (x - newhull.back().x > EPS) {
          pt y(x, front.at(x));
          newhull.push_back(pt(x, front.at(x)));
        }
        for (int i = under + 1; i < hull.size(); i++) {
          if (hull[i].x - newhull.back().x > EPS) newhull.push_back(hull[i]);
        }
      } else {
        newhull.push_back(Y[j][i]);
        newhull.push_back(Y[j][i + 1]);
      }
      hull = newhull;
    }
  }
  for (int i = 0; i < N; i++) cout << first[i] << '\n';
  return 0;
}