#include using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) int main() { cin.tie(0); ios::sync_with_stdio(false); cout<::max_digits10); ll n; cin>>n; vector a(n); rep(i,n) cin>>a[i]; ll C = 0; rep(i,n) { C+=i*a[i]; } ll D = 0; rep(i,n) { D += a[i]; } ll B = n*(n-1)/2; ll A = n*(n-1)*(2*n-1)/6; double b = 1.0*(A*D-B*C)/(n*A-B*B)*1.0; double d = (D-n*b)/B; double c = 0; rep(i,n) { double t = (b+i*d-a[i]); c += t*t; } cout << b << " " << d << endl; cout << c << endl; return 0; }