import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double N = scan.nextInt(); double[]a = new double[(int)N]; for(int i = 0; i < N; i++) { a[i] = scan.nextLong(); } scan.close(); double sum1 = 0; double sum2 = 0; for(int i = 0; i < N - 1; i++) { sum1 += a[0] - a[i + 1]; sum2 += (i + 1) * (a[0] - a[i + 1]); } double A = 2 * N; double B = N * (N - 1); double p = -2 * sum1; double C = 3 * N * (N - 1); double D = N * (N - 1) * (2 * N - 1); double q = -6 * sum2; double t = A * D - B * C; double x = (p * D - B * q) / t; double y = (A * q - p * C) / t; // System.out.println(A + " " + B + " " + C + " " + D); // System.out.println(p + " " + q); double b1 = a[0] + x; double cost = 0; for(int i = 0; i < N; i++) { double k = a[0] + x + i * y - a[i]; k *= k; //BigDecimal bd = new BigDecimal(k); //BigDecimal bd2 = bd.setScale(10, BigDecimal.ROUND_HALF_UP); //double d = Double.parseDouble(bd2.toString()); //System.out.println(d); cost += k; } System.out.println(b1 + " " + y); System.out.println(String.format("%.8f", cost)); } }