import math

def main():
    n = int(input())
    location = list(map(int, input().split()))

    ret = 0
    for i in range(1, n):
        ret += sum(location[n-i:]) / i - location[n-i-1]

    ret *= math.factorial(n-1)
    ret = int(ret % (10**9+7))
    print(ret)


if __name__ == '__main__':
    main()
