n = gets.to_i
x = gets.split.map(&:to_i)
mod = 1000000007
weight0 = n-1
(n-2).times{|i| weight0 *= n-2-i }
weight = [weight0]
(n-2).times{|i| weight.push(weight[i]+weight0/(i+2)) }
ans = 0
(n-1).times{|i|
  ans += (x[i+1]-x[i])*weight[i]
  ans %= mod
}
p ans
