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-8;
struct point {
  point() {}
  point(double nx, double ny) { x = nx, y = ny; }
  double x, y;
  bool operator<(const point &a) const {
    if (((a.x - x < 0) ? (-(a.x - x)) : (a.x - x)) < eps)
      return y < a.y;
    else
      return x < a.x;
  }
};
struct polyline {
  polyline() {}
  vector<point> src;
};
polyline t[301];
struct line {
  double a, b, c;
  line() {}
  line(point p, point 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 (((z < 0) ? (-(z)) : (z)) > eps) a /= z, b /= z, c /= z;
  }
  double dist(point 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(point a, point b, point c, point d, point &left, point &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 (((zn < 0) ? (-(zn)) : (zn)) < eps) {
    if (((m.dist(c) < 0) ? (-(m.dist(c))) : (m.dist(c))) > eps ||
        ((n.dist(a) < 0) ? (-(n.dist(a))) : (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);
  }
}
point get_inter(point a, point b, double x) {
  a.x -= b.x, a.y -= b.y;
  x -= b.x;
  double ny = x * a.y / a.x + b.y;
  return point(x + b.x, ny);
}
polyline *cross(polyline &s, point &a, point &b) {
  polyline *tmp = new polyline();
  for (int i = 0; i < s.src.size() - 1; i++) {
    point tt = get_inter(a, b, s.src[i].x);
    tmp->src.push_back(max(s.src[i], tt));
    point lft, rgt;
    if (intersect(a, b, s.src[i], s.src[i + 1], lft, rgt)) {
      tmp->src.push_back(lft);
      if (((lft.x - rgt.x < 0) ? (-(lft.x - rgt.x)) : (lft.x - rgt.x)) > eps ||
          ((lft.y - rgt.y < 0) ? (-(lft.y - rgt.y)) : (lft.y - rgt.y)) > eps)
        tmp->src.push_back(rgt);
    }
  }
  return tmp;
}
polyline *unite(polyline *f, polyline &simple) {
  polyline *result = new polyline();
  int cur = 0;
  for (int i = 1; i < (int)simple.src.size(); i++) {
    polyline tmp;
    while (f->src[cur].x < simple.src[i].x + eps && cur < f->src.size())
      tmp.src.push_back(f->src[cur]), cur++;
    cur--;
    polyline *ntmp = cross(tmp, simple.src[i - 1], simple.src[i]);
    for (int j = 0; j < ntmp->src.size(); j++) {
      if (result->src.size() == 0 ||
          ((result->src[result->src.size() - 1].x - ntmp->src[j].x < 0)
               ? (-(result->src[result->src.size() - 1].x - ntmp->src[j].x))
               : (result->src[result->src.size() - 1].x - ntmp->src[j].x)) >
              eps)
        result->src.push_back(ntmp->src[j]);
    }
  }
  result->src.push_back(
      point(max(f->src[f->src.size() - 1], simple.src[simple.src.size() - 1])));
  return result;
}
double get3(point a, point b, point c) {
  return a.x * (b.y - c.y) - b.x * (a.y - c.y) + c.x * (a.y - b.y);
}
int n, k;
double getSquare(polyline *tmp) {
  double ans = 0.0;
  tmp->src.push_back(point(k, 0));
  for (int i = 0; i < (int)tmp->src.size() - 1; i++)
    ans += get3(point(0, 0), tmp->src[i], tmp->src[i + 1]);
  tmp->src.pop_back();
  return ans / 2.0;
}
polyline *current;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k + 1; j++) {
      double y;
      cin >> y;
      t[i].src.push_back(point((double)j, y));
    }
    if (i == 0) {
      current = new polyline(t[0]);
      printf("%.10f\n", ((getSquare(current) < 0) ? (-(getSquare(current)))
                                                  : (getSquare(current))));
    } else {
      double lol = ((getSquare(current) < 0) ? (-(getSquare(current)))
                                             : (getSquare(current)));
      current = unite(current, t[i]);
      printf("%.10f\n", ((getSquare(current) < 0) ? (-(getSquare(current)))
                                                  : (getSquare(current))) -
                            lol);
    }
  }
}