def all_sum(num):
  return num * (num + 1) // 2
def all_multi(num):
  if num == 1:
    return 1
  else:
    return num * all_multi(num-1)
  
n = int(input())
x_list = [int(i) for i in input().split()]
l_list = []
for i in range(1, n):
  l_list.append(x_list[i] - x_list[~-i])
n_kaizyo = all_multi(~-n)
print(n_kaizyo)
a_list = [n_kaizyo//i * all_sum(i) for i in range(1, n)]

ans = 0
for a, l in zip(a_list, l_list):
  print(a, l)
  ans += a*l

print(ans%(10**9+7))