require 'openssl'
N,*X = $<.read.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 += F * i.to_bn.mod_inverse(M)
	((m%=M) * (X[i]-X[i-1]) + s) % M
  }.to_i