#include using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a,b,c,d,p,q; cin >> a >> b >> c >> d >> p >> q; ll xl{ LLONG_MIN }, xs{ LLONG_MAX }, yl{ LLONG_MIN }, ys{ LLONG_MAX }; for (int i = p; i <= q; ++i) { auto f = [&](int x) -> ll { return a * x * x * x + b * x * x + c * x + d; }; ll ans = f(i); if (ans > yl) { xl = i; yl = ans; } if (ans < ys) { xs = i; ys = ans; } } cout << yl << " " << xl << " " << ys << " " << xs << "\n"; return 0; }