fun main(args: Array<String>) {
    dwacon6thPrelimsB()
}

fun dwacon6thPrelimsB() {
    val n = readLine()!!.toInt()
    val xList = readLine()!!.split(' ').map { it.toLong() }.toLongArray()

    val diffs = LongArray(n - 1)
    for (i in 0 until n - 1) diffs[i] = xList[i + 1] - xList[i]

    var answer = 0.0

    var c = 1.0

    for (i in diffs.indices) {
        answer += diffs[i] * c
        answer %= MOD
        c += 1.0 / (i + 2)
    }

    for (i in 2 until n) answer = (answer * i) % MOD

    println(Math.ceil(answer).toLong() % MOD)
}

private val MOD by lazy { (Math.pow(10.0, 9.0) + 7).toLong() }
