#include using namespace std; const int INF = 1 << 30; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, c, d, p, q; cin >> a >> b >> c >> d >> p >> q; auto f = [a, b, c, d](int x) { return a * x * x * x + b * x * x + c * x + d; }; int ax = -INF, ay = -INF, bx = INF, by = INF; for (int i = p; i < q + 1; i++) { if (chmax(ay, f(i))) { ax = i; } if (chmin(by, f(i))) { bx = i; } } cout << ay << ' ' << ax << ' ' << by << ' ' << bx << '\n'; return 0; }