F(4)-decomposition#5970

F(4)-decomposition

1 second
64 megabytes
Very hard

The set consists of all infinite continued fractions [a_0, a_1, \ldots], where each partial quotient a_i (for i > 0) is less than or equal to . There are no restrictions on the integer part.

Your task is to express a given real number as the sum of two infinite continued fractions belonging to the class .

Input

The input consists of a single line containing the real number . The absolute value of does not exceed , and it is specified with up to digits after the decimal point.

Output

The output should consist of two lines. The first line should present a finite continued fraction [a_0, a_1, \ldots, a_{m-1}], and the second line should present another finite continued fraction [b_0, b_1, \ldots, b_{n-1}]. These fractions are finite approximations of infinite continued fractions, whose sum exactly equals . The sum of the values of these finite fractions must equal with a precision of at least 10^{-11}. If multiple valid decompositions exist, any of them can be provided. If no suitable fractions can be found, output NO SOLUTION on a single line.

Examples

Example 1

Loading
Loading