a,b,c,d,p,q = map(int,input().split()) result = [] for x in range(p,q+1,1): result.append((a*(x**3)+b*(x**2)+c*x+d,x)) v1,v2 = min(result),max(result) print(v2[0],v2[1],v1[0],v1[1])