a=input()
b=input()
N=int(a)
x=b.split()
d=[]
EX=0
L=1
M=1
O=0
for i in range(N-1):
	d.append(int(x[i+1])-int(x[i]))
	L=L*(i+1)
L=L/N
for j in range(N-1):
	EX+=d[j]
for k in range(N-1):
	M=M*(k+1)
	if(k>1):
		O+=L/M
		EX+=O*d[k]
print(EX%1000000007)
