from math import sqrt C0,C1,C2,C3=map(int,input().split()) L,R=map(int,input().split()) def f(x): return C0+C1*x+C2*x**2+C3*x**3 def absf(x): return abs(C0+C1*x+C2*x**2+C3*x**3) N=1000000 ans=10**10 for i in range(L*N,R*N+1): ans=min(ans,absf(i/N)) print(ans)