시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 (추가 시간 없음) | 64 MB | 0 | 0 | 0 | 0.000% |
Little Vadim has got a homework at school: he have to describe characters of one famous literary work. Vadim has successfilly finished his homework and drawn a report in form of a spreadsheet in his favorite text editor.
The spreadsheet has the following structure. It is a table of size $3 \times 3$. On intersection of the $i$-th row and the $j$-th column a text of length $a_{ij}$ is placed. The total width of the table is $w$ symbols. The text editor allows to change width of every column in arbitrary way. Let widths of the columns be $x$, $y$, $z$, and $x+y+z=w$. Then height of the $i$-th row is $h_i = \max \left( \lceil a_{i1} / x \rceil, \lceil a_{i2} / y \rceil, \lceil a_{i3} / z \rceil \right)$, and the total height of the table is $h = h_1 + h_2 + h_3$.
Vadim noticed that changing widths of the columns changes heigth of the whole table in unpredictable way. Vadim is a perfectionist, and he wants to change widths of the columns in such a way that the total height of the table is minimal.
Help Vadim and find the optimal solution.
The first line contains integer $w$ ($3 \le w \le 10^9$).
The following three lines contain three integers each. The $j$-th number in the $i$-th of these lines is integer $a_{ij}$ ($1 \le a_{ij} \le 10^{12}$).
In the first line output integer $h$ --- the minimum possible height of the whole table.
In the second line output three integers $x$, $y$, and $z$ --- widths of columns that imply the optimal solution.
If there are several solutions --- output any of them.
17 10 11 11 13 7 14 10 11 11
7 5 6 6
The following table match data from the first sample:
|
|
|
|
|
|
|
|
|