package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	n := nextInt()
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextInt()
	}
	log.Println(x[n-1] - x[0])
	log.Println(sum(x))
	y := sum(x) - x[n-1] + x[0]
	for i := n - 1; i > 0; i-- {
		x[i] = x[i] - x[i-1]
	}
	sum := 0
	for i := n; i > 1; i-- {
		k := factorial(n - 2)
		for j := 0; j < i; j++ {
			sum += (k * (j + 1)) * x[j] % mod
		}
	}
	fmt.Println((sum - y) % mod)
	// fmt.Println(-1)
	// m := make([]int, n-1)
	// for i := 0; i < n-1; i++ {
	// 	m[i] = i + 1
	// }
	// cnt := 0
	// cunter := make([]int, 3)
	// for {
	// 	log.Println(m)
	// 	cnt++
	// 	index_4 := indexSearch(m, 4)
	// 	index_3 := indexSearch(m, 3)
	// 	index_2 := indexSearch(m, 2)
	// 	index_1 := indexSearch(m, 1)
	// 	if index_2 < index_1 {
	// 		if index_3 < index_1 {
	// 			if index_4 < index_1 {
	// 				cunter[3]++
	// 			} else {
	// 				cunter[2]++
	// 			}
	// 		} else {
	// 			cunter[1]++
	// 		}
	// 	}
	// 	if !next_permutation(sort.IntSlice(m), len(m)) {
	// 		break
	// 	}
	// }
	// log.Println(cnt)
	// log.Println(cunter)
}

var mod int = 1000000000 + 7

func factorial(n int) int {
	if n == 0 {
		return 1
	}
	for i := n - 1; i > 0; i-- {
		n *= i
		n = n % mod
	}
	return n
}

func indexSearch(n []int, k int) int {
	for i := 0; i < len(n); i++ {
		if n[i] == k {
			return i
		}
	}
	return -1
}

func reverse(a sort.Interface, start int, size int) {
	for end := start + size - 1; start < end; start++ {
		a.Swap(start, end)
		end--
	}
}
func next_permutation(a sort.Interface, n int) bool {
	if n < 0 || a.Len() < n {
		return false
	}
	reverse(a, n, a.Len()-n)
	i := 0
	for i = a.Len() - 2; i >= 0; i-- {
		if a.Less(i, i+1) {
			break
		}
	}
	if i < 0 {
		reverse(a, 0, a.Len())
		return false
	}
	k := i
	for i = a.Len() - 1; i >= k+1; i-- {
		if a.Less(k, i) {
			break
		}
	}
	l := i
	a.Swap(k, l)
	reverse(a, k+1, a.Len()-(k+1))
	return true
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}
