a,b,c,d = map(int,input().split()) l,r = map(int,input().split()) m = 10**5 while l<=r: m = min(m,abs(a+b*l+c*l*l+d*l*l*l)); l += 1e-5 print(m)