n=int(input())
x=list(map(int,input().split()))
a=x[n-1]-x[0]
def fuc(n):
    a=1
    for i in range(1,n+1):
        a*=i
    return a

def comb(a,b):
    x=fuc(a)//(fuc(b)*fuc(a-b))
    return x

p=1
ans=0
for i in range(1,n):
    cnt=0
    p/=n-i
    ans+=p*(x[n-1]-x[0])*(comb(n-1,i-1))
    for j in range(i-1):
        k=i-j-1 #左から何個消えてるか
        ans+=p*(x[0]-x[k])*comb(n-1-k,i-k-1)
        cnt+=comb(n-1-k,i-k-1)


print(int(ans*fuc(n-1))%(10**9+7))
    
    

    
