import sys
sys.setrecursionlimit(1000000)

n = int(input())
x = list(map(int, input().split()))
 
def fact(m):
  return m * fact(m-1) if m != 1 else 1
 
d = [x[i+1] - x[i] for i in range(n - 1)]
fact_n_1 = fact(n-1)
print(sum(sum(fact_n_1 // (j + 1) 
              for j 
              in range(i + 1)) * d_i % 1000000007
          for i, d_i 
          in enumerate(d)) % 1000000007 ) 