#include constexpr int INF = 1 << 30; void solve() { int a, b, c, d, p, q; std::cin >> a >> b >> c >> d >> p >> q; int minx = 0, miny = INF, maxx = 0, maxy = -INF; for (int x = p; x <= q; ++x) { int y = ((a * x + b) * x + c) * x + d; if (y < miny) { minx = x; miny = y; } if (y > maxy) { maxx = x; maxy = y; } } std::cout << maxy << " " << maxx << " " << miny << " " << minx << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }