#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; int main() { ll a, b, c, d, p, q; cin >> a >> b >> c >> d >> p >> q; ll M = -INF, m = INF, Mx, mx; for (int i = p; i <= q; ++i) { ll val = a*i*i*i+b*i*i+c*i+d; if(M < val) M = val, Mx = i; if(m > val) m = val, mx = i; } printf("%lld %lld %lld %lld\n", M, Mx, m, mx); return 0; }