#include using namespace std; using ll = long long; int main(){ ll a, b, c, d, p, q, maxv = -100000000, minv = 1000000000, pos1, pos2; cin >> a >> b >> c >> d >> p >> q; auto f = [&](ll x){ return a * x * x * x + b * x * x + c * x + d; }; for(ll x = p; x <= q; x++){ ll v = f(x); if(v > maxv){ maxv = v; pos1 = x; } if(v < minv){ minv = v; pos2 = x; } } cout << maxv << " " << pos1 << " " << minv << " " << pos2 << endl; }