#include typedef long long i64; using std::cout; using std::endl; using std::cin; std::vector a; double n; double cost(double b, double d) { double ret = 0.0; for(int i = 0; i < n; i++) { ret += (a[i] - b) * (a[i] - b); b += d; } assert(ret >= 0); return ret; } double solve_D(double b, double lim) { double left, right; if(b < 0) left = 0, right = lim; else left = -lim, right = lim; for(int i = 0; i < 150; i++) { double ml = (left + left + right) / 3.0; double mr = (left + right + right) / 3.0; if(cost(b, ml) <= cost(b, mr)) { right = mr; } else { left = ml; } } return (left + right) / 2.0; } double solve_B(double lim) { double left = -1e6, right = 1e6; for(int i = 0; i < 150; i++) { double ml = (left + left + right) / 3.0; double mr = (left + right + right) / 3.0; if(cost(ml, solve_D(ml, lim)) <= cost(mr, solve_D(mr, lim))) { right = mr; } else { left = ml; } } return (left + right) / 2.0; } int main(){ cin >> n; a.resize(n); for(int i = 0; i < n; i++) cin >> a[i]; double b = solve_B(1e5); double d = solve_D(b, 1e5); double c = cost(b, d); double B = solve_B(4e5); double D = solve_D(B, 4e5); double C = cost(B, D); cout << std::fixed << std::setprecision(16); if(c < C) cout << b << " " << d << endl << c << endl; else cout << B << " " << D << endl << C << endl; return 0; }