c0,c1,c2,c3=map(int,input().split()) f=lambda x:abs(c0+c1*x+c2*x*x+c3*x*x*x) l,r=map(int,input().split()) D=1000000 a=10**10 for i in range(D): a=min(a,f(l+i*(r-l)/D)) print(a)