mod = 10**9 + 7
n = gets.to_i
s = gets.split.map &:to_f
sm = 0
sum = 0
i = 1
las = 1
(n-1).times do |r|
  sm += 1 / (r + 1).to_f
  sum += sm * (s[r+1] - s[r]) % mod
  las *= i
  i += 1
end
puts sum * las % mod