import numpy as np def f(x): return abs(c[0] + c[1] * x + c[2] * x * x + c[3] * x * x * x) c = list(map(int, input().split())) l, r = map(int, input().split()) # print(c) # print(np.roots([3*c[3],2*c[2], c[1]])) X = [l, r] + list(np.roots([3*c[3],2*c[2], c[1]])) + list(np.roots([c[3], c[2], c[1], c[0]])) ans = 10 ** 18 # print(X) for x in X: if l <= x <= r and x.imag == 0: ans = min(ans, f(x)) print(ans)