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 JAVA):

Solution:
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        int regions = in.nextInt();
        int sections = in.nextInt();
        double[] area = new double[regions];
        double[] slice = new double[sections];
        int[][] plots = new int[regions][sections + 1];
        Line[][] lines = new Line[regions][sections];
        TreeSet<Line>[] sliceLines = new TreeSet[sections];
        for (int i = 0; i < sections; i++) {
            sliceLines[i] = new TreeSet<>();
        }
        for (int i = 0; i < regions; i++) {
            plots[i][0] = in.nextInt();
            for (int j = 1; j < sections + 1; j++) {
                // Getting next slice in new region
                plots[i][j] = in.nextInt();
                lines[i][j - 1] = new Line(i, plots[i][j] - plots[i][j - 1], plots[i][j - 1]);
                Line currLine = lines[i][j - 1];
                TreeSet<Line> currSlice = sliceLines[j - 1];

                // Seeing if this line belongs in the prevalent lines
                boolean obsolete = false;
                Line beforeLine = currSlice.floor(currLine);
                Line afterLine = currSlice.ceiling(currLine);
                if (beforeLine != null) {
                    currLine.getOvertake(beforeLine);
                }
                if (afterLine != null) {
                    afterLine.getOvertake(currLine);
                    if (afterLine.overtake <= currLine.overtake) {
                        obsolete = true;
                        afterLine.getOvertake(beforeLine);
                    }
                    if (!obsolete) {
                        while (true) {
                            currSlice.remove(afterLine);
                            Line nextAfterLine = currSlice.ceiling(currLine);
                            if (nextAfterLine == null || afterLine.overtake < nextAfterLine.overtake) {
                                currSlice.add(afterLine);
                                break;
                            }
                            afterLine = nextAfterLine;
                            nextAfterLine.getOvertake(currLine);
                        }
                    }
                }
                if (!obsolete) {
                    while (beforeLine != null) {
                        if (beforeLine.overtake < currLine.overtake) {
                            break;
                        }
                        currSlice.remove(beforeLine);
                        beforeLine = currSlice.floor(currLine);
                        if (beforeLine == null) {
                            currLine.overtake = 0;
                        }
                        else {
                            currLine.getOvertake(beforeLine);
                        }
                    }
                    currSlice.add(currLine);
                }

                // Computing area covered
                double newArea = 0;
                double lastX = 0;
                Iterator<Line> areaLines = currSlice.iterator();
                currLine = areaLines.next();
                Line nextLine = null;
                while (lastX < 1) {
//                    System.out.println(j + " " + currLine.idx + " " + currLine.slope + " " + currLine.start + " " + currLine.overtake);
                    nextLine = areaLines.hasNext() ? areaLines.next() : null;
                    double nextX = nextLine == null ? 1 : Math.min(nextLine.overtake, 1);
                    double y1 = currLine.start + lastX * currLine.slope;
                    double y2 = currLine.start + nextX * currLine.slope;
                    newArea += (nextX - lastX) * (y1 + y2);
                    lastX = nextX;
                    currLine = nextLine;
                }

                // Adding to region area and updating slice area
                area[i] += newArea - slice[j - 1];
                slice[j - 1] = newArea;
            }
        }
        for (int i = 0; i < regions; i++) {
            out.printf("%.12f\n", area[i] / 2.0);
        }
    }
    public class Line implements Comparable<Line> {
        int idx;
        public double slope;
        public double start;
        public double overtake;
        public Line(int idx, double slope, double start) {
            this.idx = idx;
            this.slope = slope;
            this.start = start;
            this.overtake = 0.0;
        }
        public int compareTo(Line o) {
            if (start != o.start) {
                return Double.compare(o.start, start);
            }
            if (slope != o.slope) {
                return Double.compare(o.slope, slope);
            }
            return idx - o.idx;
        }
        public void getOvertake(Line o) {
            if (o.slope >= slope) {
                overtake = 1e9;
            }
            else {
                overtake = (o.start - start) / (slope - o.slope);
            }
        }
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }