#include using namespace std; int main(){ int n; cin >> n; vector v(n); for (int i = 0; i < n; i++) cin >> v[i]; double sum_x = n * (n+1) / 2; double sum_y = 0; double sum_xx = n * (n+1) * (2*n+1) / 6; double sum_xy = 0; for (int i = 0; i < n; i++) { sum_y += v[i]; sum_xy += v[i] * (i+1); } double a = (sum_xy * n - sum_x * sum_y) / (sum_xx * n - sum_x * sum_x); double b = (sum_xx * sum_y - sum_xy * sum_x) / (sum_xx * n - sum_x * sum_x); printf("%.8f %.8f\n", a+b, a); double c = 0; for (int i = 0; i < n; i++) { b += a; c += (v[i] - b) * (v[i] - b); } printf("%.8f\n", c); return 0; }