시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 7 2 2 66.667%

문제

Your local casino (which here in California is a fair distance away) has decided to try out a new betting game. The player is given a table on a card with N rows and M columns. Each entry ij of the table corresponds to a coin flip with a probability pij of coming up heads. All the coin flips are independent of each other. The player must choose N sets of M entries, with each set having exactly one entry from each column, and each entry being used exactly once. For each chosen set where all M coins come up heads, the player wins 1 dollar. The casino is feeling uncharacteristically generous, and so as part of the promotion of this new game, they have been handing out one card to each patron. Since you have nothing to lose, you’re going to give this game a shot. How can you maximize your expected winnings from this card?

입력

The input consists of multiple test cases. Each test case begins with a line with two integers N and M, 1 ≤ N ≤ 100, 1 ≤ M ≤ 10, separated by a space. This is followed by N lines with M space-separated numbers each, denoting the entries pij of the table. Input is followed by a single line with N = M = 0, which should not be processed.

출력

For each test case, print out a single line with the maximum expected winnings from the given table, accurate to 4 decimal places.

예제 입력

2 3
1.0 1.0 1.0
0.5 0.4 0.3
0 0

예제 출력

1.0600

힌트