|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||359||116||69||38.547%|
Professor Park conducts and records the N data values from his experiment every day. The data values are recorded in real numbers, which rounded up to the first decimal place. The data of M days are shown on a two dimensional table with each row sum and each column sum. Every experimental data values including row sums and column sums, however, must be in integers to be published. Each number can be up or down to the nearest integer so that the sum of the rounded elements in each row (column) equals the row (column) sum. More formally, if x is a real number which represents an experimental data value or a row sum or a column sum, you can replace x by ⌊x⌋ or ⌈x⌉. If this operation, i.e. feasible rounding, is possible, the new table is called feasibly rounded table.
For examples, refer to the following tables:
|(a) Original Table||(b) A feasibly rounded table||(a) Original Table||(b) A feasibly rounded table|
|Figure 1. First example of the feasible rounding||Figure 2. Second example of the feasible rounding.|
Given an original table, write a program that finds a feasibly rounded table.
Your program is to read from standard input. The first line of the input contains two integers M (2 ≤ M ≤ 200) which represents the total experiment days and N (2 ≤ N ≤ 200) which represents the experimental data values for each day. In the following M lines, all experimental data values and row sums are given in real numbers to first decimal place. The i-th line consists of N real numbers which represent the experimental data values of the i-th day (1 ≤ i ≤ M) and the i-th row sum. The next line consists of N real numbers which represent column sums. The experimental data values are between 0.0 to 1,000.0, inclusively.
Your program is to write to standard output. Print a feasibly rounded table including each row sum and column sum. It is known that the feasibly rounded table can be obtained always.
3 3 4.3 6.7 7.1 18.1 9.2 3.0 0.2 12.4 4.0 7.7 1.3 13.0 17.5 17.4 8.6
4 7 7 18 9 3 0 12 4 7 2 13 17 17 9
2 3 0.4 0.4 0.4 1.2 0.5 0.5 0.5 1.5 0.9 0.9 0.9
0 0 1 1 1 1 0 2 1 1 1