cin >> a;
cout << "b = ";
cin >> b;
cout << "c = ";
cin >> c;
cout << "d = ";
cin >> d;
p = (3 * a * c - b * b) / (3.0 * a * a);
q = (2 * b * b * b - 9 * a * b * c + 27 * a * a * d) / (27.0 * a * a * a);
if (p > 0) {
A = pow((-q / 2.0) + sqrt(q * q / 4.0 + p * p * p / 27.0), 1.0 / 3.0);
B = pow((-q / 2.0) - sqrt(q * q / 4.0 + p * p * p / 27.0), 1.0 / 3.0);
C = (-b) / (3.0 * a);
cout << "Putin korenleri " << A + B + C << endl;
} else {
double r = sqrt((-4.0 / 3.0) * p);
double theta = acos((-q) / (2.0 * r * r * r));
double real_part = cos(theta / 3.0);
double imag_part = sin(theta / 3.0);
double x1 = 2.0 * r * real_part;
double x2 = -r * (real_part + sqrt(3.0) * imag_part);
double x3 = -r * (real_part - sqrt(3.0) * imag_part);
cout << "Korenleri: " << x1 + x2 + x3 << endl;
}