a,b,c,d=map(int,input().split()) L,R=map(int,input().split()) def f(x): return abs(a+b*x+c*x*x+d*x*x*x) ans=min(f(L),f(R)) if d: if c*c-3*b*d>=0: D=c*c-3*b*d for i in ((-c+D**.5)/(3*d),(-c-D**.5)/(3*d)): if L<=i<=R: ans=min(ans,f(i)) else: if c: i=(-b)/(2*c) if L<=i<=R: ans=min(ans,f(i)) print(ans)