import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) #alist = list(map(int,input().split())) #alist = [] #s = input() c = list(map(int,input().split())) l,r = map(int,input().split()) ans = 10**18 for i in range(l*10**5,r*10**5+1): j = i / 10**5 ans = min(ans,abs(sum(c[k] * j**k for k in range(4)))) print(ans)