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

b = (1..N-1).inject(1,:*)
c = []
(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)
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 % (10**9 + 7)
