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;
class Point {
 public:
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point operator+(Point p) { return Point(x + p.x, y + p.y); }
  Point operator-(Point p) { return Point(x - p.x, y - p.y); }
  Point operator*(double a) { return Point(a * x, a * y); }
  Point operator/(double a) { return Point(x / a, y / a); }
  Point operator*(Point a) {
    return Point(x * a.x - y * a.y, x * a.y + y * a.x);
  }
  bool operator<(const Point& p) const {
    return !(fabs((x) - (p.x)) < (1e-10))
               ? x < p.x
               : (!(fabs((y) - (p.y)) < (1e-10)) && y < p.y);
  }
  bool operator==(const Point& p) const {
    return fabs(x - p.x) < (1e-10) && fabs(y - p.y) < (1e-10);
  }
};
struct Segment {
  Point p1, p2;
  Segment(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}
  bool operator<(const Segment& s) const {
    return (p2 == s.p2) ? p1 < s.p1 : p2 < s.p2;
  }
  bool operator==(const Segment& s) const {
    return (s.p1 == p1 && s.p2 == p2) || (s.p1 == p2 && s.p2 == p1);
  }
};
ostream& operator<<(ostream& os, const Point& a) {
  os << "(" << a.x << "," << a.y << ")";
}
ostream& operator<<(ostream& os, const Segment& a) {
  os << "( " << a.p1 << " , " << a.p2 << " )";
}
double dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
double norm(Point a) { return a.x * a.x + a.y * a.y; }
double abs(Point a) { return sqrt(norm(a)); }
int ccw(Point p0, Point p1, Point p2) {
  Point a = p1 - p0;
  Point b = p2 - p0;
  if (cross(a, b) > (1e-10)) return 1;
  if (cross(a, b) < -(1e-10)) return -1;
  if (dot(a, b) < -(1e-10)) return 2;
  if (norm(a) < norm(b)) return -2;
  return 0;
}
Point crosspoint(Segment l, Segment m) {
  double A = cross(l.p2 - l.p1, m.p2 - m.p1);
  double B = cross(l.p2 - l.p1, l.p2 - m.p1);
  if (abs(A) < (1e-10) && abs(B) < (1e-10)) {
    vector<Point> vec;
    vec.push_back(l.p1);
    vec.push_back(l.p2);
    vec.push_back(m.p1);
    vec.push_back(m.p2);
    sort(vec.begin(), vec.end());
    assert(vec[1] == vec[2]);
    return vec[1];
  }
  if (abs(A) < (1e-10)) assert(false);
  return m.p1 + (m.p2 - m.p1) * (B / A);
}
vector<Point> cutPolygon(vector<Point> P, Segment l) {
  vector<Point> u;
  for (int i = 0; i < P.size(); i++) {
    Point a = P[i], b = P[(i + 1) % P.size()];
    if (ccw(l.p1, l.p2, a) != -1) u.push_back(a);
    if (ccw(l.p1, l.p2, a) * ccw(l.p1, l.p2, b) == -1) {
      u.push_back(crosspoint(Segment(a, b), l));
    }
  }
  return u;
}
double getArea(vector<Point>& vec) {
  double sum = 0;
  for (int i = 0; i < vec.size(); i++)
    sum += cross(vec[i], vec[(i + 1) % vec.size()]);
  return fabs(sum) / 2.0;
}
int n, k;
vector<vector<double> > y;
void compute() {
  vector<double> answer(n, 0);
  for (int x = 0; x < k; x++) {
    vector<Point> poly(4);
    poly[0] = Point(0, 0);
    poly[1] = Point(1, 0);
    poly[2] = Point(1, 1000);
    poly[3] = Point(0, 1000);
    for (int i = 0; i < n; i++) {
      Segment seg = Segment(Point(1, y[i][x + 1]), Point(0, y[i][x]));
      vector<Point> tmp = cutPolygon(poly, seg);
      answer[i] += getArea(tmp);
      poly = cutPolygon(poly, Segment(seg.p2, seg.p1));
    }
  }
  for (int i = 0; i < n; i++) printf("%.10f\n", answer[i]);
}
int main() {
  cin >> n >> k;
  y.resize(n);
  for (int i = 0; i < n; i++) {
    y[i].resize(k + 1);
    for (int j = 0; j < k + 1; j++) cin >> y[i][j];
  }
  compute();
  return 0;
}