import java.util.*; public class Main { public static void main (String[] args) { 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(); long max = Long.MIN_VALUE; long maxValue = 0; long min = Long.MAX_VALUE; long minValue = 0; for (long i = p; i <= q; i++) { long value = i * i * i * a + i * i * b + i * c + d; if (max < value) { max = value; maxValue = i; } if (min > value) { min = value; minValue = i; } } System.out.println(max + " " + maxValue + " " + min + " " + minValue); } }