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;
int n, m, cnt, snt;
long long oo = 1000000007;
int a[510][510];
double eps = 1e-9;
const double pi = 3.1415926535897;
inline int sgn(const double &x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
struct point {
  double x, y;
  point(double _x = 0, double _y = 0) : x(_x), y(_y){};
  void scan() { scanf("%lf%lf", &x, &y); }
  void print(char ch) { printf("%lf %lf%c", x, y, ch); }
  double sqrlen() const { return x * x + y * y; }
  double len() const { return sqrt(sqrlen()); }
  bool operator==(const point &t) const {
    return sgn(x - t.x) == 0 && sgn(y - t.y) == 0;
  }
  point operator+(const point &t) const { return point(x + t.x, y + t.y); }
  point operator-(const point &t) const { return point(x - t.x, y - t.y); }
  point operator*(const double &k) const { return point(x * k, y * k); }
  double operator%(const point &t) const { return x * t.x + y * t.y; }
  point operator/(const double &k) const { return point(x / k, y / k); }
  inline double operator*(const point &t) const { return x * t.y - y * t.x; }
  point rotate() { return point(-y, x); }
} p[510], qp[510], q[510];
struct line {
  int a, b, p;
  double dg;
} l[510], dq[510];
inline double calcDg(const line &x) {
  point t = p[x.b] - p[x.a];
  return atan2(t.y, t.x);
}
inline point intersect(const point &a, const point &b, const point &c,
                       const point &d) {
  point res;
  double s1 = (c - a) * (d - a);
  double s2 = (d - b) * (c - b);
  if (!sgn(s1 + s2)) return point(2000, 2000);
  res = (b - a) * (s1 / (s1 + s2)) + a;
  return res;
}
bool onit(point x, point a, point b) {
  return sgn(x.x - max(a.x, b.x)) <= 0 && sgn(x.y - max(a.y, b.y)) <= 0 &&
         sgn(x.x - min(a.x, b.x)) >= 0 && sgn(x.y - min(a.y, b.y)) >= 0;
}
bool cmp(const line &x, const line &y) {
  return sgn(x.dg - y.dg) < 0 ||
         (sgn(x.dg - y.dg) == 0 &&
          sgn((p[x.b] - p[x.a]) * (p[y.b] - p[x.a])) > 0);
}
inline double area(const point &p0, const point &a, const point &b) {
  return abs((a - p0) * (b - p0));
}
inline void ST(int x, int n) {
  while (x < n && cmp(l[x + 1], l[x])) swap(l[x], l[x + 1]), x++;
  while (x > 1 && cmp(l[x], l[x - 1])) swap(l[x], l[x - 1]), x--;
}
double BPMJ(int n) {
  int head = 1, tail = 2;
  dq[1] = l[1];
  dq[2] = l[2];
  qp[1] = intersect(p[l[1].a], p[l[1].b], p[l[2].a], p[l[2].b]);
  point now;
  for (int i = 3; i <= n; i++)
    if (!(p[l[i].a] == p[l[i - 1].a] && p[l[i].b] == p[l[i - 1].b])) {
      now = p[l[i].b] - p[l[i].a];
      while (tail >= head + 1 && sgn(now * (qp[tail - 1] - p[l[i].a])) <= 0)
        tail--;
      while (head <= tail - 1 && sgn(now * (qp[head] - p[l[i].a])) <= 0) head++;
      qp[tail] = intersect(p[l[i].a], p[l[i].b], p[dq[tail].a], p[dq[tail].b]);
      dq[++tail] = l[i];
    }
  now = p[dq[head].b] - p[dq[head].a];
  while (tail >= head + 1 && sgn(now * (qp[tail - 1] - p[dq[head].a])) <= 0)
    tail--;
  now = p[dq[tail].b] - p[dq[tail].a];
  while (head <= tail - 1 && sgn(now * (qp[head] - p[dq[tail].a])) <= 0) head++;
  if (tail < head + 2) return 0;
  int cnt = 0;
  for (int i = head; i <= tail - 1; i++) q[++cnt] = qp[i];
  q[++cnt] =
      intersect(p[dq[tail].a], p[dq[tail].b], p[dq[head].a], p[dq[head].b]);
  double ans = 0;
  for (int i = 2; i < cnt; i++) ans += area(q[1], q[i], q[i + 1]);
  return ans;
}
double ans[310];
void work() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) scanf("%d", &a[i][j]);
  }
  for (int k = 1; k <= m; k++) {
    p[1] = point(0, 0);
    p[2] = point(1, 0);
    p[3] = point(1, 1000);
    p[4] = point(0, 1000);
    for (int i = 1; i <= 4; i++)
      l[i].a = i, l[i].b = (i & 3) + 1, l[i].dg = calcDg(l[i]), l[i].p = 0;
    sort(l + 1, l + 5, cmp);
    int np = 4;
    for (int i = 1; i <= n; i++) {
      if (i > 1) {
        int pos = 0;
        for (int j = 1; j <= i + 3; j++)
          if (l[j].p == i - 1) {
            pos = j;
            break;
          }
        swap(l[pos].a, l[pos].b);
        l[pos].dg = calcDg(l[pos]);
        ST(pos, i + 3);
      }
      np = i * 2 + 2;
      p[np + 1] = point(1, a[i][k]);
      p[np + 2] = point(0, a[i][k - 1]);
      l[i + 4].a = np + 1;
      l[i + 4].b = np + 2;
      l[i + 4].dg = atan2(a[i][k - 1] - a[i][k], -1);
      l[i + 4].p = i;
      np += 2;
      ST(i + 4, i + 4);
      double tmp = BPMJ(i + 4);
      ans[i] += tmp;
    }
  }
  for (int i = 1; i <= n; i++) printf("%.10f\n", ans[i] / 2);
}
int main() {
  work();
  return 0;
}