import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here // 入力 Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int p = sc.nextInt(); int q = sc.nextInt(); // 算出 int maxHeight = Integer.MIN_VALUE; int maxX = 0; int minHeight = Integer.MAX_VALUE; int minX = 0; for(int x = p; x <= q; x++){ int height = a*x*x*x + b*x*x + c*x + d; if(maxHeight < height){ maxHeight = height; maxX = x; } if(height < minHeight){ minHeight = height; minX = x; } } // 出力 System.out.println(maxHeight + " " + maxX + " " + minHeight + " " + minX); } }