#include using namespace std; int main(){ long long a,b,c,d,p,q;cin>>a>>b>>c>>d>>p>>q; long long mn,mnp=-1000,mx,mxp=-1000; for(long long i = p; q >= i; i++){ if(mnp == -1000){ mnp = i; mn = a*i*i*i+b*i*i+c*i+d; }else if(mn > a*i*i*i+b*i*i+c*i+d){ mnp = i; mn = a*i*i*i+b*i*i+c*i+d; } if(mxp == -1000){ mxp = i; mx = a*i*i*i+b*i*i+c*i+d; }else if(mx < a*i*i*i+b*i*i+c*i+d){ mxp = i; mx = a*i*i*i+b*i*i+c*i+d; } } cout << mx << " " << mxp << " " << mn << " " << mnp << endl; }