Skyland#3567

Skyland

5 seconds
64 megabytes
Hard

Somewhere in the sky, KM kingdom built floating islands by their highly developed technology. The islands are numbered from to .

The king of the country, Kita_masa, can choose any non-negative real number as the altitude for each island, as long as the sum of the altitudes is greater than or equal to . For floating the island to the altitude h_i, it costs b_i \times h_i. Besides, it costs c_{i,j} \times |h_i - h_j| for each pair of islands and since there are communications between these islands.

Recently, energy prices are rising, so the king, Kita_masa, wants to minimize the sum of the costs. The king ordered you, a court programmer, to write a program that finds the altitudes of the floating islands that minimize the cost.

Input

The input contains several test cases. Each test case starts with a line containing two integers and (1 \le n \le 100, 0 \le H \le 1000), separated by a single space. The next line contains integers b_1, b_2, \ldots, b_n (0 \le b_i \le 1000). Each of the next lines contains integers c_{i,j} (0 \le c_{i,j} \le 1000), where c_{i,i} = 0 and c_{i,j} = c_{j,i}.

The last test case is followed by a line containing two zeros.

Output

For each test case, print its case number. Then print a line containing a space-separated list of the altitudes of the islands that minimizes the sum of the costs. If there are several possible solutions, print any of them. Your answer will be accepted if the altitude of each island is non-negative, the sum of the altitudes is greater than or equal to , and the cost calculated from your answer has an absolute or relative error less than 10^{-9} from the optimal solution.

Follow the format of the sample output.

Examples

Example 1

Loading
Loading