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