# -*- coding: utf-8 -*-
# INPUT

import math

num = int(input())
slimes = list(map(int, input().split()))

w = 0
for i in range(0,num-1):
    tmp = 0
    for j in range(0,num-1-i):
        tmp = tmp + (slimes[num-j-1] - slimes[i])
    
    w = w + (tmp * (math.factorial(num - 1) / (num - 1 - i)))

ans = w % (pow(10,9) + 7)
         
print(int(ans))