import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) # 1次方程式cx def solve(a,b,c,d,e,f): """ ax + by + c = 0 dx + ey + f = 0 """ v = (a*e-b*d) if v==0: # 縮退している if b!=0: return (0, -c/b) else: return (-c/a,0) x = - (c*e - f*b) / v y = (d*c - a*f) / v # print(a*x+b*y+c, d*x+e*y+f) return (x,y) n = int(input()) aa = list(map(int, input().split())) a = n b = n*(n+1)//2 c = -sum(aa) d = n*(n+1)//2 e = n*(n+1)*(2*n+1)//6 f = -sum(((i+1)*aa[i] for i in range(n))) x,y = solve(a,b,c,d,e,f) print(x+y,y) print(sum((x+(i+1)*y-aa[i])**2 for i in range(n)))