import numpy as np n = int(input()) x = np.arange(n) y = np.array(input().split(), dtype=np.intc) (b, a), error, _, _, _ = np.polyfit(x, y, deg=1, full=True) print("{:.12f} {:.12f}".format(a, b)) print("{:.12f}".format(*error))