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

dx = [0]*(n-1)
for i in range(n-1):
    dx[i] = x[i+1] - x[i]

def fact(n):
    if n <= 1:
        return n
    else:
        return n*fact(n-1)
    
r = fact(n-1)//2
res = 0
for j in range(n-1):
    if j == 0:
        res += dx[j]*fact(n-1)
    else:
        res += dx[j]*fact(n-1) + r
        r = r + r/(j+1)
        
ans = int(res%(10**9+7))
print(ans)