#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll a,b,c,d,p,q; cin >> a >> b >> c >> d >> p >> q; auto f = [&](ll x) { return a * x * x * x + b * x * x + c * x + d; }; ll Max = -1e18, argMax = -1, Min = +1e18, argMin = -1; for(ll x = p; x <= q; x++) { ll fx = f(x); if(Max < fx) { Max = fx; argMax = x; } if(Min > fx) { Min = fx; argMin = x; } } cout << Max << " " << argMax << " " << Min << " " << argMin << endl; }