// x^3 + bx^2 + cx + d = 0
// |b|, |c|, |d| <= 1000
// a = 1
// |x^3| > |bx^2 + cx + d|
// |x| >= (max(|b|, |c|, |d|) + 1)*3
// |x| <= 1000
// [L..R]
// f(L) < 0, f(R) > 0
// a = 1
double eps = 1e-12;
double L = -1000, R = 1000
// double = 15
// L, R ---> 1000
for (int k = 0; k < 60; k++)
//while (R - L > eps)
{
double x = (L + R) / 2;
if (f(x) < 0)
L = x;
else
R = x;
}
// (x-1)^3 = 0
// x = 1 + a
// (x - 1)^3 = a^3
// x += 10^{-15}
// a^3 += 10^{-15}
// a < 10^{-5}
P(x) = (x - a)^2 * Q(x)
P'(x) = (x - a) * T(x)
gcd (P(x), P'(x))