This page is still under construction.

Parts of this page are still being built. What you see may change.

Another Lottery

Time limit1sMemory limit256 MB

Summary
Each of n players buys tickets across m rounds; round j pays 2^j to one random ticket. For each player, print the reduced fraction for the probability of winning strictly more money than everyone else.
Level

Medium7 of 10

Topics
Probability, Math, Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

Even in times of economic crisis, the people of Byteland still enjoy playing lotteries. With a bit of luck they might shed all their worries and become rich.

The most popular lottery in Byteland consists of mm rounds. In each round everyone may buy as many tickets as they wish, and among all tickets sold in that round exactly one is drawn at random, each ticket with equal probability. The owner of that ticket wins the prize money of the round. Because the people of Byteland love powers of two, the prize money for the winner of round ii is 2i2^i Bytelandian Dollars.

For each participant, determine the probability that they win more money than anybody else.

Input

The input consists of several test cases. Each test case begins with a line containing two integers nn and mm: the number of participants and the number of rounds (1≤n≤100001 \le n \le 10000, 1≤m≤301 \le m \le 30).

The next nn lines describe the tickets bought by the participants. The ii-th of these lines contains mm non-negative integers c1,…,cmc_1, \ldots, c_m, where cjc_j (1≤j≤m1 \le j \le m) is the number of tickets participant ii bought in round jj. The total number of tickets sold in each round is between 11 and 10910^9.

The input ends with a line containing two zeros.

Output

For each test case, print nn lines. Line ii contains the probability, as a reduced fraction, that participant ii wins the most money. Print each fraction in the form numerator / denominator with a single space on each side of the slash (for example 1 / 4; a probability of zero is printed as 0 / 1).

Examples1

  1. Example 1

    Input
    5 4
    3 1 2 3
    3 1 2 4
    3 1 3 5
    4 4 4 0
    5 5 0 0
    1 1
    1
    0 0
    
    Expected output
    1 / 4
    1 / 3
    5 / 12
    0 / 1
    0 / 1
    1 / 1