C0,C1,C2,C3=map(int,input().split()) L,R=map(int,input().split()) def f(x): return abs(C0+C1*x+C2*x**2+C3*x**3) if C3!=0: X1=(-C2+(C2**2-12*C1*C2)**0.5)/3/C3 X2=(-C2-(C2**2-12*C1*C2)**0.5)/3/C3 ans=min(f(L),f(R)) if L<=X1<=R: ans=min(ans,f(X1)) if L<=X2<=R: ans=min(ans,f(X2)) else: if C2!=0: X=-C1/2/C2 ans=min(f(L),f(R)) else: if C1!=0: ans=min(f(L),f(R)) else: ans=0 print(ans)