N = gets.chomp.to_i
X = gets.chomp.split.map(&:to_i)

c = []
(N-1).times do |i|
  if i == 0
    c[i] = 1
  else
    c[i] = c[i-1] + 1.0/(i+1)
  end
end

k = []
(N-1).times do |i|
  k[i] = X[i+1] - X[i]
end

ans = 0
(N-1).times do |i|
  ans += c[i] * k[i]
end
p (ans * (1..N-1).inject(1,:*) % (10**9 + 7)).to_i
