a, b, c, d = map(int, input().split()) L, R = map(int, input().split()) def f(x): return a + b * x + c * x * x + d * x * x * x ans = [f(L), f(R)] if d != 0: p = c * c / (3 * d) - b if p == 0: x = -c / (3 * d) ans.append(f(x)) elif p > 0: p /= (3 * d) p = p ** 0.5 x, y = p - c / (3 * d), -p - c / (3 * d) x, y = x / (3 * d), y / (3 * d) ans.append(f(x)) ans.append(f(y)) else: if c != 0: x = -b / (2 * c) ans.append(f(x)) m, M = min(ans), max(ans) if m * M <= 0: print(0) else: print(min(abs(m), abs(M)))