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;
template <class T>
T Mul(T x, T y, T P) {
  T F1 = 0;
  while (y) {
    if (y & 1) {
      F1 += x;
      if (F1 < 0 || F1 >= P) F1 -= P;
    }
    x <<= 1;
    if (x < 0 || x >= P) x -= P;
    y >>= 1;
  }
  return F1;
}
template <class T>
T Pow(T x, T y, T P) {
  T F1 = 1;
  x %= P;
  while (y) {
    if (y & 1) {
      F1 = Mul(F1, x, P);
    }
    x = Mul(x, x, P);
    y >>= 1;
  }
  return F1;
}
template <class T>
T Gcd(T x, T y) {
  if (y == 0) return x;
  T z;
  while (z = x % y) {
    x = y, y = z;
  }
  return y;
}
template <class T>
void UpdateMin(T &x, T y) {
  if (y < x) {
    x = y;
  }
}
template <class T>
void UpdateMax(T &x, T y) {
  if (x < y) {
    x = y;
  }
}
template <class T>
T Sqr(const T x) {
  return x * x;
}
template <class T>
T Abs(const T x) {
  return x < 0 ? -x : x;
}
class ReadBuffer {
 private:
  char buff[20000000];
  char *buf;

 public:
  void init(int size = 20000000) {
    fread(buff, 1, size, stdin);
    buf = buff;
  }
  template <class T>
  bool readInteger(T &x) {
    x = 0;
    while (*buf && isspace(*buf)) ++buf;
    if (*buf == 0) return false;
    static bool flag;
    flag = 0;
    if (*buf == '-')
      flag = true;
    else
      x = *buf - '0';
    while (isdigit(*++buf)) x = x * 10 + *buf - '0';
    if (flag) x = -x;
    return true;
  }
  template <class T>
  bool readFloat(T &x) {
    long double nowpos = 0.1;
    x = 0;
    while (*buf && isspace(*buf)) ++buf;
    if (*buf == 0) return false;
    static bool flag, decimal;
    decimal = flag = 0;
    if (*buf == '-')
      flag = true, ++buf;
    else if (*buf == '.')
      decimal = true;
    while (isdigit(*buf) || *buf == '.') {
      if (*buf == '.')
        decimal = true;
      else {
        if (decimal) {
          x += nowpos * (*buf - '0');
          nowpos *= 0.1;
        } else {
          x = x * 10 + *buf - '0';
        }
      }
      ++buf;
    }
    return true;
  }
  bool readChar(char c) {
    if (*buf == 0) return 0;
    return c = *buf++, 1;
  }
  bool readString(char *s) {
    while (*buf && isspace(*buf)) ++buf;
    if (!*buf) return false;
    while (!isspace(*buf)) *s++ = *buf++;
    *s++ = 0;
    return true;
  }
  int countSpacetonext() {
    int total = 0;
    while (*buf && *buf == ' ') ++total, ++buf;
    return total;
  }
  bool splitBycharactor(char *s, char Split = '\n') {
    while (*buf && *buf != Split) *s++ = *buf++;
    *s++ = 0;
    return *buf != 0;
  }
};
struct EDGE {
  int T;
  EDGE *Nxt;
};
const double eps = 1e-6;
inline int Sign(double a) { return a < -eps ? -1 : a > eps; }
struct Point {
  double x, y;
  Point() {}
  Point(double x, double y) : x(x), y(y) {}
  void Input() { scanf("%lf %lf", &x, &y); }
  bool operator<(const Point &p) const {
    return Sign(x - p.x) < 0 || Sign(x - p.x) == 0 && Sign(y - p.y) < 0;
  }
  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*(const double &p) const { return Point(x * p, y * p); }
  Point operator/(const double &p) const { return Point(x / p, y / p); }
  bool operator==(const Point &p) const {
    return Sign(x - p.x) == 0 && Sign(y - p.y) == 0;
  }
};
inline double Det(const Point &a, const Point &b) {
  return a.x * b.y - a.y * b.x;
}
inline double Dot(const Point &a, const Point &b) {
  return a.x * b.x + a.y * b.y;
}
inline bool In_The_Seg(const Point &a, const Point &b, const Point &c) {
  return Sign(Dot(a - c, b - c)) <= 0;
}
inline bool Seg_Intersect(const Point &a, const Point &b, const Point &c,
                          const Point &d, Point &e) {
  double s1 = Det(c - a, d - a);
  double s2 = Det(d - b, c - b);
  if (!Sign(s1 + s2)) return 0;
  e = (b - a) * (s1 / (s1 + s2)) + a;
  return In_The_Seg(a, b, e) && In_The_Seg(c, d, e);
}
vector<Point> S, NS;
int maxv[301];
double ans;
int n, k;
int y[301];
Point now[301];
inline Point getpoint(const Point &a, const Point &b, double x) {
  return Point(x, ((x - a.x) * b.y + (b.x - x) * a.y) / (b.x - a.x));
}
inline double calc(const Point &c, const Point &d, const Point &a,
                   const Point &b) {
  if (Sign(a.y - c.y) >= 0 && Sign(b.y - d.y) >= 0) {
    return (a.y - c.y + b.y - d.y) / 2 * (b.x - a.x);
  } else
    return 0.0;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= k; ++i) S.push_back(Point(i * 1.0, 0.0));
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      scanf("%d", y + j);
      now[j] = Point(j, y[j]);
    }
    int iter = 0;
    NS.clear();
    double ans = 0;
    for (int i = 0; i < k; ++i) {
      while (Sign(S[iter].x - (i + 1)) < 0) {
        Point ps = getpoint(now[i], now[i + 1], S[iter].x);
        Point x = S[iter];
        ++iter;
        Point y = S[iter];
        Point pt = getpoint(now[i], now[i + 1], S[iter].x);
        Point z;
        if (Seg_Intersect(ps, pt, x, y, z)) {
          ans += calc(x, z, ps, z);
          if (ps.y >= x.y)
            NS.push_back(ps);
          else
            NS.push_back(x);
          NS.push_back(z);
          ans += calc(z, y, z, pt);
          if (y.y >= pt.y)
            NS.push_back(y);
          else
            NS.push_back(pt);
        } else {
          if (ps.y >= x.y)
            NS.push_back(ps);
          else
            NS.push_back(x);
          ans += calc(x, y, ps, pt);
          if (y.y >= pt.y)
            NS.push_back(y);
          else
            NS.push_back(pt);
        }
      }
    }
    printf("%.10f\n", ans);
    NS.resize(unique(NS.begin(), NS.end()) - NS.begin());
    swap(NS, S);
  }
  return 0;
}