N = int(input())
*X, = map(int,input().split())

mod = 10**9+7

ans = 0
f = 1
for i in range(2,N):
    f *= i
    f %= mod
cnt = 0
for i,x in enumerate(X[:-1],1):
    tmp = f * pow(i,mod-2,mod)
    cnt += tmp
    cnt %= mod
    ans -= tmp*x
    ans %= mod
ans += cnt*X[-1]%mod
ans %= mod
print(ans)