import numpy as np from scipy.optimize import minimize_scalar, shgo, 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) res = minimize_scalar(f, bounds=(l, r), method="bounded") print('{:f}'.format(res.fun))