a, b, c, d, p, q = map(int, input().split()) def f(x): return a * x**3 + b * x**2 + c * x + d xmax = p xmin = p for x in range(p + 1, q + 1): if f(x) > f(xmax): xmax = x if f(x) < f(xmin): xmin = x print(f(xmax), xmax, f(xmin), xmin)