import collections as c
ip = lambda : map(int, input().split())
# ##############
N = int(input())
l = list(ip())
d = []
for i in range(N-1):
    d.append(l[i+1]-l[i])

ans = 0;mod = 1e9+7;c=0;l=1
for i in range(N-1):
    # if i == 0:
    #     c = 1
    # else:
    #     c = (c*(i+1)/(i*l) + 1)*l
    # print(ans)
    # ans = (ans*(i+1)%mod + d[i]*c)%mod
    # l = (l*i+1)%mod
    c+=1/(i+1)
    ans += c*d[i]
    ans%=mod
    l *= i+1
print(int(ans*l%mod))