N = int(input())
X = list(map(int,input().split()))
MOD = 10 ** 9 + 7
goal = X[-1]
ans = goal - X[0]
x = 1
for i in range(1,N-1):
    tmp = goal - X[i]
    ans = (ans * (i+1) + (x*tmp)) % MOD
    x *= i+1
    #print(tmp,ans,x)
print(ans)