package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}

	nums := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		nums[i] = i
	}
	p := permutations(nums)

	sum := 0
	for i := 0; i < len(p); i++ {
		o := p[i]
		o = append(o, len(o))
		for j := 0; j < len(o)-1; j++ {
			x1, x2 := o[j], o[j+1]
			d := abs(x[x1] - x[x2])
			sum += d
		}
	}

	pp := float64(sum) / float64(len(p))
	ans := int(pp*float64(factorial(n-1))) % 1000000007

	fmt.Println(ans)
}

// 1000000007

func factorial(n int) int {
	a := 1
	for i := 1; i <= n; i++ {
		a *= i % 1000000007
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func permutations(arr []int) [][]int {
	var helper func([]int, int)
	res := [][]int{}

	helper = func(arr []int, n int) {
		if n == 1 {
			tmp := make([]int, len(arr))
			copy(tmp, arr)
			res = append(res, tmp)
		} else {
			for i := 0; i < n; i++ {
				helper(arr, n-1)
				if n%2 == 1 {
					tmp := arr[i]
					arr[i] = arr[n-1]
					arr[n-1] = tmp
				} else {
					tmp := arr[0]
					arr[0] = arr[n-1]
					arr[n-1] = tmp
				}
			}
		}
	}
	helper(arr, len(arr))
	return res
}
