import math
import copy

n = int(input())
x = list(map(int, input().split()))
y = copy.copy(x)
y.insert(n, 0)
del y[0]
z = [a - b for (a, b) in zip(y, x)]
s = (sum(x[0:n-1])+sum(z[:n-1]))*math.factorial(n-2)
s = int(s%(10**9+7))
print(s)
