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