a,b,c,d,p,q=map(int,input().split()) def f(x): return a*x**3+b*x*x+c*x+d M=m=[f(p),p] for i in range(p,q+1): t=f(i) if M[0]t: m=[t,i] print(*M,*m)