a,b,c,d,p,q=map(int,input().split()) def f(x): return a*x**3+b*x**2+c*x+d mx,MX=p,q if f(p)>f(q): mx,MX=q,p elif f(p)==f(q): mx,MX=p,p if (b**2-3*a*c)>0 and a!=0: ex1=round(min((-b+(b**2-3*a*c)**0.5)/3/a,(-b-(b**2-3*a*c)**0.5)/3/a)) ex2=round(max((-b+(b**2-3*a*c)**0.5)/3/a,(-b-(b**2-3*a*c)**0.5)/3/a)) if p <= ex1 <= q: mx=mx if f(mx)f(ex1) else ex1 if p <= ex2 <= q: mx=mx if f(mx)f(ex2) else ex2 elif a==0 and b!=0: x=round(c/b) if p <= x <= q: mx=x if f(mx)>f(x) else mx MX=x if f(MX)