n = int(input())
x = list(map(int,input().split()))

N = 1e+9 + 7

def seq(m):
    tmp = 1
    l = []
    ans = []
    for i in range(m-1):
        tmp *= (i+1)
        l.append(tmp)
    for k in range(m-1):
        ans.append(int(tmp/(k+1)))
    return ans


ln = seq(n)
a = 0
b = 1

for i in range(n-1):
    b *= (i+1)
    a += ((ln[i]%N) * (x[-1]-x[i]))%N

b *= n
print(int(a%N))