# https://mirucacule.hatenablog.com/entry/2021/09/14/183909 import numpy as np from scipy.optimize import minimize c0, c1, c2, c3 = map(int, input().split()) l, r = map(int, input().split()) def f(x): return abs(c0 + c1 * x + c2 * x**2 + c3 * x**3) div = 100 x = np.linspace(l, r, div) y = f(x) x0 = l + ((r - l) / div) * (np.argmin(y) + 1) # initial point bnds = ((l, r),) res = minimize(f, x0, method='Nelder-Mead', bounds=bnds, tol=1e-5) print('{:f}'.format(res.fun))