import time import random class Timer: def __init__(self, timelimit): self.start_time = time.time() self.timelimit = timelimit def timeover(self): return (time.time() - self.start_time) >= self.timelimit def elapsed(self): return time.time() - self.start_time def f(x, c): return c[0] + c[1] * x + c[2] * x * x + c[3] * x * x * x def main(): c = list(map(int, input().split())) l, r = list(map(int, input().split())) timer = Timer(1.9) ans = float("inf") while not timer.timeover(): x = random.uniform(l, r) ans = min(ans, abs(f(x, c))) print(ans) if __name__ == "__main__": main()