n = gets.to_i
x = gets.split(" ").map(&:to_i)

def fact(n)
  (1..n).inject(1, :*)
end

d = Array.new(n - 1, 0)
(0..(n - 2)).each do |i|
  d[i] = x[i + 1] - x[i]
end

min = d.inject(&:+)
zz = (0..(d.size - 2)).to_a

costs = []
(0..(d.size)).each do |i|
  zz.combination(i).each do |combi|
    costs.push(min + combi.inject(0) { |sum, v| sum += d[v] })
  end
end

cost = costs.inject(:+) / costs.size.to_f

puts (cost * fact(n - 1)).to_i % 1000000007