#include using namespace std; int main() { int64_t a, b, c, d, p, q; cin >> a >> b >> c >> d >> p >> q; auto f = [&](int64_t x) -> int64_t { return a * x * x * x + b * x * x + c * x + d; }; int64_t n = p, m = p; for (int64_t i = p; i <= q; i++) { if (f(i) < f(n)) n = i; if (f(i) > f(m)) m = i; } cout << f(m) << ' ' << m << ' ' << f(n) << ' ' << n << '\n'; return 0; }