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 int md = 1000000007;
const int maxn = 333;
const long long inf = 2020202020202020202LL;
struct line {
  double a, b, c;
};
int n, k;
vector<vector<pair<double, double> > > g(maxn);
vector<set<pair<double, double> > > nice(maxn);
line build_line(pair<double, double> t1, pair<double, double> t2) {
  line d;
  d.a = t2.second - t1.second;
  d.b = t1.first - t2.first;
  d.c = t2.first * t1.second - t1.first * t2.second;
  return d;
}
pair<double, double> line_int(line t1, line t2) {
  pair<double, double> t;
  double e = t2.b * t1.a - t1.b * t2.a;
  if (e == 0) {
    t.first = md;
    t.second = md;
  } else {
    double x = t1.b * t2.c - t2.b * t1.c;
    double y = t1.a * t2.c - t2.a * t1.c;
    x = x / e;
    y = y / e;
    y = -y;
    t = make_pair(x, y);
  }
  return t;
}
int cmpy(pair<double, double> a, pair<double, double> b) {
  if (a.second > b.second) return 1;
  if (a.second < b.second) return -1;
  return 0;
}
double count_s(set<pair<double, double> > nice) {
  double s = 0;
  int x = nice.size() - 1;
  for (int i = 0; i < x; i++) {
    pair<double, double> a = *nice.begin();
    nice.erase(a);
    pair<double, double> b = *nice.begin();
    double g = a.second + b.second;
    g = g * (b.first - a.first);
    g = g / 2;
    s = s + g;
  }
  return s;
}
double doit(int v, int u) {
  line r = build_line(g[u][v], g[u][v + 1]);
  pair<double, double> lbound, rbound;
  lbound = g[u][v];
  rbound = g[u][v + 1];
  for (int i = 0; i < u; i++) {
    line q = build_line(g[i][v], g[i][v + 1]);
    pair<double, double> z = line_int(q, r);
    if ((z.first >= v) && (z.first <= v + 1)) {
      if (cmpy(g[u][v], g[i][v]) == 1) {
        if (rbound.first > z.first) rbound = z;
      }
      if (cmpy(g[u][v], g[i][v]) == -1) {
        if (lbound.first < z.first) lbound = z;
      }
      if (cmpy(g[u][v], g[i][v]) == 0) {
        if (cmpy(g[u][v + 1], g[i][v + 1]) <= 0)
          if (rbound.first > z.first) rbound = z;
      }
    } else {
      if (cmpy(g[u][v], g[i][v]) != 1) return 0;
    }
  }
  if (lbound.first >= rbound.first) return 0;
  double h1 = count_s(nice[v]);
  set<pair<double, double> > nice2;
  int x = nice[v].size();
  for (int i = 0; i < x; i++) {
    pair<double, double> d = *nice[v].begin();
    nice2.insert(d);
    nice[v].erase(d);
  }
  x = nice2.size();
  for (int i = 0; i < x; i++) {
    pair<double, double> d = *nice2.begin();
    nice2.erase(d);
    if (!((d.first >= lbound.first) && (d.first <= rbound.first)))
      nice[v].insert(d);
  }
  nice[v].insert(lbound);
  nice[v].insert(rbound);
  double h2 = count_s(nice[v]);
  return h2 - h1;
}
int main() {
  cin >> n >> k;
  cout.precision(8);
  for (int i = 0; i < n; i++) {
    double s = 0;
    for (int j = 0; j < k + 1; j++) {
      int y;
      cin >> y;
      g[i].push_back(make_pair(j, y));
    }
    for (int j = 0; j < k; j++) s += doit(j, i);
    cout << fixed << s << endl;
  }
  return 0;
}