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