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

b = (1..N-1).inject(1,:*)
b %= (10**9 + 7)
c = []
ans = 0
(N-1).times do |i|
  if i == 0
    c[i] = 1 * b
  else
    c[i] = c[i-1] + (1*b)/(i+1)
  end
  c[i] %= (10**9 + 7)
  ans += c[i] * (X[i+1] - X[i])
  ans %= (10**9 + 7)
end
p ans
