N = int(input()) lsa = list(map(int,input().split())) def calc_r(p):#p=(x,y) r = 0 x,y = p for i in range(N): r += abs(i*x+y-lsa[i])**2 return r def calc_y(x): low_y = -10**5 high_y = 10**5 cnt = 200 while cnt: cnt -= 1 c1 = (low_y*2+high_y)/3 c2 = (low_y+high_y*2)/3 if calc_r((x,c1)) < calc_r((x,c2)): high_y = c2 else: low_y = c1 return low_y low_x = -10**5 high_x = 10**5 cnt = 200 while cnt: cnt -= 1 c1 = (low_x * 2 + high_x) / 3 c2 = (low_x + high_x * 2) / 3 if calc_r((c1,calc_y(c1))) < calc_r((c2,calc_y(c2))): high_x = c2 else: low_x = c1 print(calc_y(low_x),low_x) print(calc_r((low_x,calc_y(low_x))))