import sys input=lambda: sys.stdin.readline().rstrip() a,b,c,d,p,q=map(int,input().split()) def f(x): return a*x**3+b*x**2+c*x+d Ans=[f(p),p,f(p),p] for i in range(p,q): cur=f(i+1) if cur>Ans[0]: Ans[1]=i+1 Ans[0]=cur if cur