#include int main() { int a, b, c, d, p, q; scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &p, &q); int i, j; for (i = j = p; i <= q; i++) if (a * i * i * i + b * i * i + c * i + d > a * j * j * j + b * j * j + c * j + d) j = i; printf("%d %d ", a * j * j * j + b * j * j + c * j + d, j); for (i = j = p; i <= q; i++) if (a * i * i * i + b * i * i + c * i + d < a * j * j * j + b * j * j + c * j + d) j = i; printf("%d %d\n", a * j * j * j + b * j * j + c * j + d, j); return 0; }