N = int(input())
Xs = [0] + list(map(int, input().split()))
mod = 10**9 + 7
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

NNN = (10**6)
g1 = [1, 1]
inverse = [0, 1]

for i in range( 2, NNN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )

mxx = Xs[-1]
r = 0
for i in range(N):
    i += 1
    for j in range(1, N-i):
        ue = mul(g1[N-1], Xs[i+j] - Xs[i])
        ff = mul(mul(ue, inverse[j+1]), inverse[j])
        r = (r + ff) % mod
    ue = mul(g1[N-1], Xs[N]-Xs[i])
    ff = mul(ue,inverse[N-i])
    r = (r+ff)%mod

print(r)
