#include typedef long long i64; using std::cout; using std::endl; using std::cin; std::vector a; int n; double cost(double b, double d, bool f = false) { double ret = 0.0; for(int i = 0; i < n; i++) { ret += (a[i] - b) * (a[i] - b); b += d; if(ret > (1LL << 60)) return 1LL << 60; } return ret; } double solve_D(double b) { double left = -1e5, right = 1e5; 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, true) <= cost(b, mr, true)) { right = mr; } else { left = ml; } } return (left + right) / 2.0; } double solve_B() { double left = -1e5, right = 1e5; 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)) <= cost(mr, solve_D(mr))) { 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(); double d = solve_D(b); double c = cost(b, d); cout << std::fixed << std::setprecision(10); cout << b << " " << d << endl << c << endl; return 0; }