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 INF = 1e100;
double EPS = 1e-12;
struct PT {
  double x, y;
  PT() {}
  PT(double x_, double y_) : x(x_), y(y_) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(double c) const { return PT(x * c, y * c); }
  PT operator/(double c) const { return PT(x / c, y / c); }
  bool operator<(const PT o) const {
    if (x != o.x) return x < o.x;
    return y < o.y;
  }
  bool operator==(const PT o) const {
    return fabs(x - o.x) + fabs(y - o.y) < EPS;
  }
};
double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
double dist2(PT p, PT q) { return dot(p - q, p - q); }
bool LinesParallel(PT a, PT b, PT c, PT d) {
  return fabs(cross(b - a, c - d)) < EPS;
}
bool LinesCollinear(PT a, PT b, PT c, PT d) {
  return LinesParallel(a, b, c, d) && fabs(cross(a - b, a - c)) < EPS &&
         fabs(cross(c - d, c - a)) < EPS;
}
bool SegmentsIntersect(PT a, PT b, PT c, PT d) {
  if (LinesCollinear(a, b, c, d)) return false;
  if (cross(d - a, b - a) * cross(c - a, b - a) > 0) return false;
  if (cross(a - c, d - c) * cross(b - c, d - c) > 0) return false;
  return true;
}
PT ComputeLineIntersection(PT a, PT b, PT c, PT d) {
  b = b - a;
  d = c - d;
  c = c - a;
  assert(dot(b, b) > EPS && dot(d, d) > EPS);
  return a + b * cross(c, d) / cross(b, d);
}
int N, K;
int in[305][305];
double area[305];
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; i++)
    for (int j = 0; j <= K; j++) scanf("%d", &in[i][j]);
  for (int j = 0; j < K; j++) {
    vector<PT> intersections;
    intersections.push_back(PT(j, 0));
    intersections.push_back(PT(j + 1, 0));
    double previousArea = 0;
    for (int i = 1; i <= N; i++) {
      PT a = PT(j, in[i][j]);
      PT b = PT(j + 1, in[i][j + 1]);
      if (a.y >= intersections[0].y &&
          b.y >= intersections[intersections.size() - 1].y) {
        intersections.clear();
        intersections.push_back(a);
        intersections.push_back(b);
      } else {
        vector<PT> crosses;
        for (int k = 0; k < intersections.size() - 1; k++) {
          if (SegmentsIntersect(intersections[k], intersections[k + 1], a, b)) {
            PT p = ComputeLineIntersection(intersections[k],
                                           intersections[k + 1], a, b);
            crosses.push_back(p);
          }
        }
        sort(crosses.begin(), crosses.end());
        crosses.erase(unique(crosses.begin(), crosses.end()), crosses.end());
        if (crosses.size()) {
          if (crosses.size() == 1) {
            if (a.y >= intersections[0].y) {
              crosses.push_back(a);
            } else if (b.y >= intersections[intersections.size() - 1].y) {
              crosses.push_back(b);
            }
          }
          if (crosses.size() == 2) {
            if (crosses[0].x > crosses[1].x) swap(crosses[0], crosses[1]);
            for (auto it = intersections.begin(); it != intersections.end();) {
              if (it->x >= crosses[0].x && it->x <= crosses[1].x) {
                it = intersections.erase(it);
              } else {
                it++;
              }
            }
            intersections.push_back(crosses[0]);
            intersections.push_back(crosses[1]);
          }
        }
      }
      sort(intersections.begin(), intersections.end());
      double currentArea = 0;
      for (int k = 0; k < intersections.size() - 1; k++) {
        PT p1 = intersections[k];
        PT p2 = intersections[k + 1];
        currentArea += 0.5 * (p2.y + p1.y) * (p2.x - p1.x);
      }
      area[i] += currentArea - previousArea;
      previousArea = currentArea;
    }
  }
  for (int i = 1; i <= N; i++) {
    printf("%.9lf\n", area[i] + EPS);
  }
  return 0;
}