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;
void run();
int main() {
  ios::sync_with_stdio(0);
  run();
}
long double slope(pair<long double, long double> const &a) {
  return a.second - a.first;
}
long double plot(pair<long double, long double> const &a, long double const x) {
  return a.first * (1 - x) + a.second * x;
}
struct slomp {
  bool operator()(pair<long double, long double> const &a,
                  pair<long double, long double> const &b) const {
    return slope(a) < slope(b);
  }
};
bool above(pair<long double, long double> const &a,
           pair<long double, long double> const &b, long double const x0 = 0,
           long double const x1 = 1) {
  pair<long double, long double> c = {a.first - b.first, a.second - b.second};
  return min(plot(c, x0), plot(c, x1)) >= -1e-10L;
}
long double isect(pair<long double, long double> const &a,
                  pair<long double, long double> const &b) {
  long double c = b.first - a.first;
  long double m = (b.second - b.first) - (a.second - a.first);
  if (m >= 0 and c > 0 or m <= 0 and c < 0) return 1e30L;
  return -c / m;
}
long double integrate(pair<long double, long double> const &a, long double x0,
                      long double x1) {
  return plot(a, (x0 + x1) / 2.L) * (x1 - x0);
}
pair<long double, long double> raw[300][300];
long double res[300];
struct wotsit {
  set<pair<long double, long double>, slomp> active;
  long double area;

 private:
  long double get_start(
      set<pair<long double, long double>, slomp>::iterator it) {
    if (it == active.begin()) return 0.L;
    auto jt = it;
    --jt;
    return isect(*it, *jt);
  }
  long double get_end(set<pair<long double, long double>, slomp>::iterator it) {
    auto jt = it;
    ++jt;
    if (jt == active.end()) return 1.L;
    return isect(*it, *jt);
  }

 public:
  void remove(set<pair<long double, long double>, slomp>::iterator it) {
    auto at = it;
    if (it != active.begin()) --at;
    auto bt = it;
    bt++;
    long double lef = 0.L;
    long double rgt = 1.L;
    if (it != active.begin()) lef = max(lef, isect(*at, *it));
    if (bt != active.end()) rgt = min(rgt, isect(*it, *bt));
    if (it != active.begin() and bt != active.end()) {
      long double x = isect(*at, *bt);
      area += integrate(*at, lef, x);
      area += integrate(*bt, x, rgt);
    } else if (it != active.begin()) {
      area += integrate(*at, lef, 1.L);
    } else if (bt != active.end()) {
      area += integrate(*bt, 0.L, rgt);
    }
    area -= integrate(*it, lef, rgt);
    active.erase(it);
  }
  void insert(pair<long double, long double> const &add) {
    for (int q = 1; ~q;) {
      auto it = active.lower_bound(add);
      if (q and it != active.begin()) --it;
      if (it == active.end()) break;
      long double lef = get_start(it);
      long double rgt = get_end(it);
      auto jt = it;
      if (it != active.begin()) --jt;
      if (above(add, *it, lef, rgt)) {
        remove(it);
      } else
        --q;
    }
    {
      auto it = active.lower_bound(add);
      long double x = 1.L;
      if (it != active.end()) x = get_start(it);
      auto at = it;
      if (it != active.begin() and it == active.end()) --at;
      if (not active.empty() and plot(add, x) <= plot(*at, x) + 1e-10L) {
        return;
      }
      long double lef = 0.L, rgt = 1.L;
      auto jt = it;
      if (it != active.begin()) {
        --jt;
        lef = max(lef, isect(add, *jt));
      }
      if (it != active.end()) {
        rgt = get_end(it);
        rgt = min(rgt, isect(add, *it));
      }
      if (it != active.begin()) area -= integrate(*jt, lef, x);
      if (it != active.end()) area -= integrate(*it, x, rgt);
      area += integrate(add, lef, rgt);
      active.insert(add);
    }
  }
};
void run() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= q; j++) {
      cin >> raw[i][j].first;
      if (j) raw[i][j - 1].second = raw[i][j].first;
    }
  while (q--) {
    wotsit tracker = {};
    for (int i = 0; i < n; i++) {
      long double was = res[i];
      res[i] -= tracker.area;
      tracker.insert(raw[i][q]);
      res[i] += tracker.area;
    }
  }
  cout.precision(12);
  cout << fixed;
  for (int i = 0; i < n; i++) cout << res[i] << endl;
}