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 PI = 3.1415926535897932384626434;
const double eps = 1e-9;
inline int sign(double a) { return a < -eps ? -1 : a > eps; }
inline double hypot(double a, double b) { return sqrt(a * a + b * b); }
struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
  Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
  Point operator*(double d) const { return Point(x * d, y * d); }
  Point operator/(double d) const { return Point(x / d, y / d); }
  bool operator<(const Point &p) const {
    int c = sign(x - p.x);
    if (c) return c == -1;
    return sign(y - p.y) == -1;
  }
  bool operator==(const Point &p) const {
    return sign(x - p.x) == 0 && sign(y - p.y) == 0;
  }
  double dot(const Point &p) const { return x * p.x + y * p.y; }
  double det(const Point &p) const { return x * p.y - y * p.x; }
  double alpha() const { return atan2(y, x); }
  double distTo(const Point &p) const {
    double dx = x - p.x, dy = y - p.y;
    return hypot(dx, dy);
  }
  double alphaTo(const Point &p) const {
    double dx = x - p.x, dy = y - p.y;
    return atan2(dy, dx);
  }
  Point rotAlpla(const double &alpha, const Point &o = Point(0, 0)) const {
    double nx = cos(alpha) * (x - o.x) + sin(alpha) * (y - o.y);
    double ny = -sin(alpha) * (x - o.x) + cos(alpha) * (y - o.y);
    return Point(nx, ny) + o;
  }
  Point rot90() const { return Point(-y, x); }
  Point unit() { return *this / abs(); }
  double abs() { return hypot(x, y); }
  double abs2() { return x * x + y * y; }
  void testWrite() { cout << "(" << x << "," << y << ")" << endl; }
  double getrad() {
    double res = atan2(y, x);
    if (res < 0) res += 2 * PI;
    if (fabs(res - 2 * PI) < 1e-10) return 0;
    return res;
  }
  void read() { scanf("%lf%lf", &x, &y); }
  void write() { printf("%lf %lf ", x, y); }
};
Point lineLineIntersect(Point p1, Point p2, Point q1, Point q2) {
  double a1 = ((q2.x - q1.x) * (p1.y - q1.y) - (p1.x - q1.x) * (q2.y - q1.y)),
         a2 = -((q2.x - q1.x) * (p2.y - q1.y) - (p2.x - q1.x) * (q2.y - q1.y));
  return (p1 * a2 + p2 * a1) / (a1 + a2);
}
double minDiff(double a, double b) {
  return min(fabs(a - b), 2 * PI - fabs(a - b));
}
vector<Point> convexCut(const vector<Point> &ps, Point q1, Point q2) {
  vector<Point> qs;
  int n = ps.size();
  for (int i = 0; i < n; i++) {
    Point p1 = ps[i], p2 = ps[(i + 1) % n];
    int d1 = sign(
            ((q2.x - q1.x) * (p1.y - q1.y) - (p1.x - q1.x) * (q2.y - q1.y))),
        d2 = sign(
            ((q2.x - q1.x) * (p2.y - q1.y) - (p2.x - q1.x) * (q2.y - q1.y)));
    if (d1 >= 0) qs.push_back(p1);
    if (d1 * d2 < 0) qs.push_back(lineLineIntersect(p1, p2, q1, q2));
  }
  return qs;
}
double Circum(const vector<Point> &ps) {
  int n = ps.size();
  double ret = 0;
  for (int i = 0; i < n; i++) ret += ps[i].distTo(ps[(i + 1) % n]);
  return ret;
}
double calcArea(const vector<Point> &ps) {
  int n = ps.size();
  double ret = 0;
  for (int i = 0; i < n; i++) ret += ps[i].det(ps[(i + 1) % n]);
  return ret / 2.0;
}
vector<Point> convexHull(vector<Point> ps) {
  int n = ps.size();
  if (n <= 1) return ps;
  sort(ps.begin(), ps.end());
  vector<Point> qs;
  for (int i = 0; i < n; qs.push_back(ps[i++])) {
    while (qs.size() > 1 &&
           sign(((qs.back().x - qs[qs.size() - 2].x) *
                     (ps[i].y - qs[qs.size() - 2].y) -
                 (ps[i].x - qs[qs.size() - 2].x) *
                     (qs.back().y - qs[qs.size() - 2].y))) <= 0)
      qs.pop_back();
  }
  for (int i = n - 2, t = qs.size(); i >= 0; qs.push_back(ps[i--])) {
    while ((int)qs.size() > t &&
           sign(((qs.back().x - qs[(int)qs.size() - 2].x) *
                     (ps[i].y - qs[(int)qs.size() - 2].y) -
                 (ps[i].x - qs[(int)qs.size() - 2].x) *
                     (qs.back().y - qs[(int)qs.size() - 2].y))) <= 0)
      qs.pop_back();
  }
  qs.pop_back();
  return qs;
}
double convexDiameter(const vector<Point> &ps) {
  int n = ps.size();
  int is = 0, js = 0;
  for (int i = 1; i < n; i++) {
    if (ps[i].x > ps[is].x) is = i;
    if (ps[i].x < ps[js].x) js = i;
  }
  double maxd = ps[is].distTo(ps[js]);
  int i = is, j = js;
  do {
    if ((ps[(i + 1) % n] - ps[i]).det(ps[(j + 1) % n] - ps[j]) >= 0)
      (++j) %= n;
    else
      (++i) %= n;
    maxd = max(maxd, ps[i].distTo(ps[j]));
  } while (i != is || j != js);
  return maxd;
}
bool onSegment(Point p, Point q1, Point q2) {
  return sign(((q2.x - q1.x) * (p.y - q1.y) - (p.x - q1.x) * (q2.y - q1.y))) ==
             0 &&
         sign((p - q1).dot(p - q2)) <= 0;
}
bool isIntersect(Point p1, Point p2, Point q1, Point q2) {
  return sign(((p2.x - p1.x) * (q1.y - p1.y) - (q1.x - p1.x) * (p2.y - p1.y))) *
                 ((p2.x - p1.x) * (q2.y - p1.y) -
                  (q2.x - p1.x) * (p2.y - p1.y)) <
             0 &&
         sign(((q2.x - q1.x) * (p1.y - q1.y) - (p1.x - q1.x) * (q2.y - q1.y))) *
                 ((q2.x - q1.x) * (p2.y - q1.y) -
                  (p2.x - q1.x) * (q2.y - q1.y)) <
             0;
}
bool isVertical(Point p1, Point p2, Point q1, Point q2) {
  return sign((p2 - p1).det(q2 - q1)) == 0;
}
double distPointToLine(Point p, Point u, Point v) {
  return abs((u - p).det(v - p)) / u.distTo(v);
}
double distPointToSegment(Point p, Point u, Point v) {
  if ((u - v).abs() < eps) return (p - u).abs();
  Point v1 = u - v, v2 = p - u, v3 = p - v;
  if (sign(v1.dot(v2)) < 0)
    return v2.abs();
  else if (sign(v1.dot(v3)) > 0)
    return v3.abs();
  else
    return fabs(v1.det(v2)) / v1.abs();
}
int inPoly(Point q, vector<Point> &p) {
  int n = p.size();
  for (int i = 0; i < n; i++) {
    if (onSegment(q, p[i], p[(i + 1) % n])) return false;
  }
  Point q2;
  double offsite = 1e10;
  for (;;) {
    int flag = true;
    int rnd = rand() % 10000;
    q2.x = cos((double)rnd) * offsite;
    q2.y = sin((double)rnd) * offsite;
    for (int i = 0; i < n; ++i) {
      if (onSegment(p[i], q, q2)) {
        flag = false;
        break;
      }
      if (flag) break;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt += isIntersect(p[i], p[(i + 1) % n], q, q2);
  }
  return cnt & 1;
}
int inConvex(const vector<Point> &a, const Point &b) {
  int n = a.size();
  if (n <= 2) return 0;
  Point g = (a[0] + a[n / 3] + a[2 * n / 3]) / 3.0;
  int l = 0, r = n;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (sign((a[l] - g).det(a[mid] - g)) > 0) {
      if (sign((a[l] - g).det(b - g)) >= 0 && sign((a[mid] - g).det(b - g)) < 0)
        r = mid;
      else
        l = mid;
    } else {
      if (sign((a[l] - g).det(b - g)) < 0 && sign((a[mid] - g).det(b - g)) >= 0)
        l = mid;
      else
        r = mid;
    }
  }
  r %= n;
  int z = sign((a[r] - b).det(a[l] - b)) - 1;
  if (z == -2) return 1;
  return z;
}
bool isInterLinCir(Point c, double r, Point l1, Point l2) {
  return (distPointToLine(c, l1, l2) - r) <= 0;
}
bool isInterSegCir(Point c, double r, Point p1, Point p2) {
  if ((distPointToLine(c, p1, p2) - r) > 0) return false;
  if (sign(c.distTo(p1) - r) <= 0 || sign(c.distTo(p2) - r) <= 0) return true;
  Point c2 = (p2 - p1).rot90() + c;
  return sign(((c2.x - c.x) * (p1.y - c.y) - (p1.x - c.x) * (c2.y - c.y))) *
             sign(
                 ((c2.x - c.x) * (p2.y - c.y) - (p2.x - c.x) * (c2.y - c.y))) <=
         0;
}
bool isInterCirCir(Point c1, double r1, Point c2, double r2) {
  double dis = c1.distTo(c2);
  return sign(dis - fabs(r1 - r2)) >= 2 && sign(dis - (r1 + r2)) <= 0;
}
int interLinCir(Point c, double r, Point l1, Point l2, Point &p1, Point &p2) {
  if (!isInterLinCir(c, r, l1, l2)) return 0;
  Point c2 = c + (l2 - l1).rot90();
  c2 = lineLineIntersect(c, c2, l1, l2);
  double t = sqrt(r * r - (c2 - c).abs2());
  p1 = c2 + (l2 - l1).unit() * t;
  p2 = c2 - (l2 - l1).unit() * t;
  if (sign(t) == 0)
    return 1;
  else
    return 2;
}
void interCirCir(Point c1, double r1, Point c2, double r2, Point &p1,
                 Point &p2) {
  double t = (1 + (r1 * r1 - r2 * r2) / (c1 - c2).abs2()) / 2;
  Point u = c1 + (c2 - c1) * t;
  Point v = u + (c2 - c1).rot90();
  interLinCir(c1, r1, u, v, p1, p2);
}
inline Point getCirPoint(Point c, double r, double rd) {
  return Point(c.x + r * cos(rd), c.y + r * sin(rd));
}
int getTangents(Point c1, double r1, Point c2, double r2, Point *a, Point *b) {
  int cnt = 0;
  if (r1 < r2) {
    swap(c1, c2);
    swap(r1, r2);
    swap(a, b);
  }
  double d2 = (c1 - c2).abs2();
  double rdiff = r1 - r2, rsum = r1 + r2;
  if (d2 < rdiff * rdiff) return 0;
  double base = atan2(c2.y - c1.y, c2.x - c1.x);
  if (sign(d2) == 0 && sign(r1 - r2) == 0) return -1;
  if (sign(d2 - rdiff * rdiff) == 0) {
    a[cnt] = getCirPoint(c1, r1, base);
    b[cnt] = getCirPoint(c2, r2, base);
    return 1;
  }
  double ang = acos((r1 - r2) / sqrt(d2));
  a[cnt] = getCirPoint(c1, r1, base + ang);
  b[cnt] = getCirPoint(c2, r2, base + ang);
  cnt++;
  a[cnt] = getCirPoint(c1, r1, base - ang);
  b[cnt] = getCirPoint(c1, r1, base - ang);
  cnt++;
  if (sign(d2 - rsum * rsum) == 0) {
    a[cnt] = getCirPoint(c1, r1, base);
    b[cnt] = getCirPoint(c2, r2, base + PI);
    cnt++;
  } else if (d2 > rsum * rsum) {
    double ang = acos((r1 + r2) / sqrt(d2));
    a[cnt] = getCirPoint(c1, r1, base + ang);
    b[cnt] = getCirPoint(c2, r2, PI + base + ang);
    cnt++;
    a[cnt] = getCirPoint(c1, r1, base - ang);
    b[cnt] = getCirPoint(c1, r1, PI + base - ang);
    cnt++;
  }
  return cnt;
}
Point centerCirOut(const Point &a, const Point &b, const Point &c) {
  double a1 = b.x - a.x, b1 = b.y - a.y, c1 = (a1 * a1 + b1 * b1) / 2;
  double a2 = c.x - a.x, b2 = c.y - a.y, c2 = (a2 * a2 + b2 * b2) / 2;
  double d = a1 * b2 - a2 * b1;
  return Point(a.x + (c1 * b2 - c2 * b1) / d, a.y + (a1 * c2 - a2 * c1) / d);
}
bool isPointInCir(Point c, double r, Point p) {
  return sign((p - c).abs2() - r * r) <= 0;
}
struct Circle {
  double r;
  Point c;
  Circle() {}
  Circle(Point a, double b) : r(b), c(a) {}
  Point getPoint(double a) { return Point(c.x + cos(a) * r, c.y + sin(a) * r); }
};
bool isPointInCir(Point P, Circle C) {
  return sign((C.c - P).abs() - C.r) <= 0;
}
double Angle(Point a, Point b) {
  if (sign(a.abs2()) == 0 || sign(b.abs2()) == 0 || sign((a - b).abs2() == 0))
    return 0;
  return acos(max((double)-1, min((double)1, a.dot(b) / a.abs() / b.abs())));
}
double Cross(const Point &a, const Point &b) { return a.x * b.y - a.y * b.x; }
double Area2(Point A, Point B, Point C) { return Cross(B - A, C - A); }
Point GetLineProjection(Point p, Point A, Point B) {
  Point v = B - A;
  return A + v * (v.dot(p - A)) / (v.dot(v));
}
struct Line {
  Point p;
  Point v;
  double ang;
  Line() {}
  Line(Point p, Point v) : p(p), v(v) { ang = atan2(v.y, v.x); }
  bool operator<(const Line &L) const { return ang < L.ang; }
  Point getPoint(double a) { return p + v * a; }
};
int getSegCircleIntersection(Line L, Circle cir, vector<Point> &sol) {
  if (sign(distPointToLine(cir.c, L.p, L.p + L.v) - cir.r) == 0) {
    Point A = GetLineProjection(cir.c, L.p, L.p + L.v);
    if (onSegment(A, L.p, L.p + L.v) || L.p == A || L.p + L.v == A)
      sol.push_back(A);
    return sol.size();
  }
  double t1, t2;
  double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d = L.p.y - cir.c.y;
  double e = a * a + c * c, f = 2 * (a * b + c * d),
         g = b * b + d * d - cir.r * cir.r;
  double delta = f * f - 4 * e * g;
  if (sign(delta) < 0)
    return 0;
  else if (sign(delta) == 0) {
    t1 = -f / (2 * e);
    if (sign(t1) >= 0 && sign(t1 - 1) <= 0) {
      sol.push_back(L.getPoint(t1));
    }
    return sol.size();
  }
  t1 = (-f - sqrt(delta)) / (2 * e);
  if (sign(t1) >= 0 && sign(t1 - 1) <= 0) sol.push_back(L.getPoint(t1));
  t2 = (-f + sqrt(delta)) / (2 * e);
  if (sign(t2) >= 0 && sign(t2 - 1) <= 0) sol.push_back(L.getPoint(t2));
  if (sol.size() == 2 && t1 > t2) swap(sol[1], sol[0]);
  return sol.size();
}
double areaPolyCirX(vector<Point> &p, Circle c) {
  int n = p.size();
  double m = c.r, ans = 0;
  Point O = Point();
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    bool b = isPointInCir(p[i], c);
    bool b2 = isPointInCir(p[j], c);
    double opr;
    Point A = p[i], B = p[j];
    if (sign(Area2(O, A, B)) >= 0)
      opr = 1;
    else
      opr = -1;
    if (b && b2) {
      ans += opr * fabs(Area2(A, B, O)) / 2;
    } else if (!b && !b2) {
      Line l = Line(A, B - A);
      vector<Point> sol;
      getSegCircleIntersection(l, c, sol);
      if (sol.size() == 2) {
        ans += opr * fabs(Area2(sol[0], sol[1], O)) / 2;
        ans += opr * m * m / 2 * (Angle(A, sol[0]) + Angle(sol[1], B));
      } else {
        ans += opr * m * m / 2 * (Angle(A, B));
      }
    } else {
      Line l = Line(A, B - A);
      vector<Point> sol;
      getSegCircleIntersection(l, c, sol);
      if (sol.size() == 2) {
        ans += opr * fabs(Area2(sol[0], sol[1], O)) / 2;
        ans += opr * m * m / 2 * (Angle(A, sol[0]) + Angle(sol[1], B));
      } else if (b) {
        ans += opr * fabs(Area2(sol[0], A, O)) / 2;
        ans += opr * m * m / 2 * (Angle(sol[0], B));
      } else {
        ans += opr * fabs(Area2(sol[0], B, O)) / 2;
        ans += opr * m * m / 2 * (Angle(sol[0], A));
      }
    }
  }
  ans = fabs(ans);
  return ans;
}
void testCutConvex() {
  Point A(0, 0);
  Point B(1, 0);
  Point C(1, 1);
  Point D(0, 1);
  Point E(10, 0);
  Point F(11, 1);
  vector<Point> q;
  q.push_back(A);
  q.push_back(B);
  q.push_back(C);
  q.push_back(D);
  vector<Point> eddie = convexCut(q, E, F);
  for (int i = 0; i < eddie.size(); i++) eddie[i].testWrite();
}
const int maxn = 300 + 10;
double yy[maxn];
int main() {
  int n, k;
  scanf("%d%d", &k, &n);
  vector<Point> q[maxn];
  for (int i = 0; i < n; i++) {
    q[i].push_back(Point(i, 0));
    q[i].push_back(Point(i + 1, 0));
    q[i].push_back(Point(i + 1, 2000));
    q[i].push_back(Point(i, 2000));
  }
  double last = 2000 * n;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < n + 1; j++) {
      scanf("%lf", &yy[j]);
    }
    for (int j = 0; j < n; j++) {
      q[j] = convexCut(q[j], Point(j, yy[j]), Point(j + 1, yy[j + 1]));
    }
    double now = 0;
    for (int j = 0; j < n; j++) now += fabs(calcArea(q[j]));
    printf("%.20lf\n", last - now);
    last = now;
  }
  return 0;
}