#require 'pp'

MOD = 10 ** 9 + 7
n = gets.chomp!.to_i
x_n = gets.split.map(&:to_i)
diff_n = Array.new(n)
x_n.each_cons(2).with_index do |x, i|
    diff_n[i] = x[1] - x[0]
end
diff_n.pop

total = (1..(n-1)).inject(1){|sum, n| sum = sum * n }
counter = Array.new(n - 1, 0)
x = [total]
sum = total * diff_n[0]
#pp x
#pp sum
1.upto(n-2) do |i|
    a = []
    n = 0
    x.each do |y|
        a << (y / (i + 1)) * i + n
        n = (y / (i + 1))
    end
    a << n
    x = a
    #pp x

    sub = 0
    a.each_with_index do |t, i|
       sub += t * (i+1)
    end
    #pp sub
    
    sum += sub * diff_n[i] % MOD
end

puts sum % MOD
