// yukicoder No.1132 #include using namespace std; using ll = long long; constexpr ll mod = 1000000007; const ll INF = mod * mod; int main() { ll a, b, c, d, p, q; cin >> a >> b >> c >> d >> p >> q; ll x_min = p; ll x_max = p; ll y_min = INF; ll y_max = -INF; for(ll i = p; i <= q; ++i) { ll tmp = a * pow(i, 3) + b * pow(i, 2) + c * i + d; //cout << tmp << "\n"; if(tmp < y_min) { y_min = tmp; x_min = i; } if(tmp > y_max) { y_max = tmp; x_max = i; } } cout << y_max << " " << x_max << " " << y_min << " " << x_min << "\n"; return 0; }