eolymp
bolt
Try our new interface for solving problems
Problems

Thinking Backward

Thinking Backward

Plane division by a common shape is a very well known topic of computer science. The pictures below shows some such diagrams. In figure \textbf{1} we find that four circles divide a plane in maximum \textbf{14} zones, four ellipses divide a plane in maximum \textbf{26} zones and three triangles divide a plane in maximum \textbf{20} zones. It is a common practice to find out the maximum number of regions when \textbf{m} shapes of same type intersects. For example the general formula for circles is \textbf{m^2} - \textbf{m} + \textbf{2}. When the situation is hybrid (More than one type of shapes intersect) the maximum possible number of regions is also not very difficult to find out. \includegraphics{https://static.e-olymp.com/content/50/502e6b125aa7101e1f52bf7b7b77e9717aecc85a.jpg} In figure \textbf{2} we can see that eight regions are created when one ellipse and one triangle intersect. In this problem you will have to think in the reverse direction. You will be given the maximum number of regions created and you will have to find how many ellipses, circles and triangles were involved. \InputFile The input file contains less than \textbf{300} lines of inputs. Each line contains a \textbf{32}-bit unsigned integer \textbf{N}, which is the maximum number of regions, created by \textbf{m} ellipses, \textbf{n} circles and \textbf{p} triangles. Input is terminated by a line, which contains a \textbf{--1}. This line should not be processed. All input numbers other than the \textbf{--1} in the last line are positive numbers. \OutputFile For each line of input you have to produce two or more lines of output. The description of output for each line is given below: The first line is the serial number of output. Each of the next lines contains three integers. These three integers are possible values of \textbf{m}, \textbf{n} and \textbf{p} for which maximum \textbf{N} regions is created. When there is more than one solution then the solutions should be sorted in ascending of \textbf{m} and then by ascending order of \textbf{n}. If there is no valid solution output a line “Impossible.” instead. Look at the output for sample input for details. Please note that for a valid solution \textbf{0} ≤ \textbf{m} < \textbf{100}, \textbf{0} ≤ \textbf{n} < \textbf{20000} and \textbf{0} ≤ \textbf{p} < \textbf{100}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
20
10
-1
Output example #1
Case 1:
0 0 3
0 1 2
1 0 2
1 3 0
Case 2:
Impossible.