Hide

Problem E
Sign Profile

Consider a polynomial $f(x)$ like the one plotted below. For sufficiently small (large negative magnitude) values of $x$, the function $f(x)$ has a negative value. As $x$ gets larger (more positive), $f(x)$ become positive, then negative again, then positive again. We could describe the left-to-right behavior of this curve with the string “-+-+”.

\includegraphics[width=0.5\textwidth ]{curve1}

For curves like this, we say the sign profile is a string of + and - characters. If $\lim _{x \rightarrow -\infty } f(x) < 0$, the string starts with -. Otherwise, it starts with +. Each time the curve crosses the $X$ axis, we append another character to the string that has the opposite sign of its predecessor. Thus, the sign profile is a sequence of alternating + and - characters that describes the sign of the curve from left to right. If $\lim _{x \rightarrow \infty } f(x) < 0$, the string ends with -. Otherwise it ends with +.

Input

Input consists of up to 100 test cases, one per line. Each test case consists of four real numbers, $c_0$, $c_1$, $c_2$ and $c_3$, some of which may be zero. Each is in the range $[-100,100]$ with at most $8$ digits past the decimal point. These values give the coefficients of a polynomial $f( x ) = c_0 + c_1 x + c_2 x^2 + c_3 x^3$. The end of input is marked with values of zero for all coefficients. The input data will be such that the answer will not change if any of the non-zero coefficients are changed by $10^{-6}$ or less.

Output

For each test case, print out a line giving the sign profile of $f(x)$.

Sample Input 1 Sample Output 1
-1 -3 4 -1
-1 0 -5 5
-0.2 0 1 0
0 0 0 0
+-+-
-+
+-+

Please log in to submit a solution to this problem

Log in