import numpy n=input() a=map(float,raw_input().split()) b,d=numpy.polyfit(range(n),a,1) print d,b,sum([(d+b*i-a[i])**2 for i in range(n)])