#B
mod = 10**9 + 7
N = int(input())
perm = 1
for i in range(N-1):
    perm*=(i+1)
    
X = list(map(int,input().split()))
D = []
for i in range(N-1):
    D.append(X[i+1]-X[i])
    


kai = 1
ans = 0
for k in range(N-1):
    kai*=(k+1)
    ans += int(perm*D[k]*(2-(1/kai)))
    ans%=mod
    print(kai)
    

ans%=mod
print(ans)




