using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; class Program { static void Main() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; var sc = new Scan(); long n = sc.Int; var a = sc.LongArr; if (n == 2) { sw.WriteLine("{0} {1}", a[0], a[1] - a[0]); sw.WriteLine(0); sw.Flush(); return; } long n1 = n * (n - 1) / 2; long n2 = n * (n - 1) * (n * 2 - 1) / 6; long asum = 0, asum2 = 0; for (int i = 0; i < n; i++) { asum += a[i]; asum2 += a[i] * i; } double b = (n2 * asum - n1 * asum2) / (double)(n * n2 - n1 * n1); double d = (n * asum2 - n1 * asum) / (double)(n * n2 - n1 * n1); double c = 0; for (int i = 0; i < n; i++) { c += pow(b + i * d - a[i]); } sw.WriteLine("{0} {1}", b, d); sw.WriteLine(c); sw.Flush(); } static double pow(double a) { return a * a; } } class Scan { public int Int { get { return int.Parse(Str); } } public long Long { get { return long.Parse(Str); } } public string Str { get { return Console.ReadLine().Trim(); } } public int[] IntArr { get { return StrArr.Select(int.Parse).ToArray(); } } public int[] IntArrWithSep(char sep) { return Str.Split(sep).Select(int.Parse).ToArray(); } public long[] LongArr { get { return StrArr.Select(long.Parse).ToArray(); } } public double[] DoubleArr { get { return StrArr.Select(double.Parse).ToArray(); } } public string[] StrArr { get { return Str.Split(); } } }