C0,C1,C2,C3=map(int,input().split()) L,R=map(int,input().split()) def f(x): return abs(C0+C1*x+C2*x*x+C3*x*x*x) ANS=[f(L),f(R),f((L+R)/2),f((L+R)/3),f((L+R)/3*2)] if C2*C2-3*C1*C3>=0: x=(C2*C2-3*C1*C3)**(1/2) if 3*C3!=0 and L<=(-C2+x)/(3*C3)<=R: ANS.append(f((-C2+x)/(3*C3))) if 3*C3!=0 and L<=(-C2-x)/(3*C3)<=R: ANS.append(f((-C2-x)/(3*C3))) if C2!=0 and L<=-C1/(2*C2)<=R: ANS.append(f(-C1/(2*C2))) for i in range(10**6): x=L+(R-L)/(10**6)*i ANS.append(f(x)) print(min(ANS))