require 'openssl'
N = gets.to_i
X = gets.split.map &:to_i
M = 10**9+7
m = 0.to_bn
F = (2...N).inject(m+1) {|s,i| s.mod_mul(i,M)}
p (0...N).inject {|s,i|
	m = m.mod_add(F * i.to_bn.mod_inverse(M), M)
	m.mod_mul(X[i]-X[i-1],M).mod_add(s,M)
  }.to_i