import math
n = int(input())
ls_x = list(map(int,input().split()))
c1 = math.factorial(n-1)
c = [c1]
cn = 0
ans = 0
for i in range(n-1):
    ans -= (ls_x[i] * c1//(i+1))
    cn += (c1//(i+1))
    ans = int(ans % (10**9+7))
    cn = int(cn % (10**9+7))

ans += cn * ls_x[n-1]
ans = int(ans % (10**9+7))
print(ans)
