#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <deque>
#include <functional>
#include <initializer_list>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

void VintOut(std::vector<int>& A){
    const int n = A.size();
    if(n == 0){putchar('\n'); return;}
    printf("%d", A[0]);
    for(int i = 1; i < n; ++i) printf(" %d", A[i]);
    putchar('\n');
}
void VintOut(std::vector<long long int>& A){
    const int n = A.size();
    if(n == 0){ putchar('\n'); return;}
    printf("%lld", A[0]);
    for(int i = 1; i < n; ++i) printf(" %lld", A[i]);
    putchar('\n');
}

template <typename T>
inline bool chmin(T& a, T b){
    if(b < a){ a = b; return true;}
    return false;
}

template <typename T>
inline bool chmax(T& a, T b){
    if(a < b){ a = b; return true;}
    return false;
}

inline bool bitUP(int state, int k){ return (state >> k) & 1; }
inline bool bitUP(long long int state, int k){ return (state >> k) & 1;}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

namespace MyFunc{
    using LLi = long long int;
    using ULLi = unsigned long long int;
    // GCD(a, b) ; a, bの最大公約数を求める関数
    inline LLi gcd(LLi a, LLi b){ while(b != 0){ a %= b; std::swap(a, b);} return a; }
    // LCM(a, b) ; a, bの最小公倍数を求める関数
    inline LLi lcm(LLi a, LLi b){ return (a * b) / MyFunc::gcd(a, b);}
    // 累乗を求める関数
    inline LLi power(LLi a, LLi n){
        LLi res = 1LL, waiting = a;
        while(n != 0LL){ if((n & 1LL) != 0LL) res *= waiting; waiting *= waiting; n >>= 1;}
        return res;
    }
    // 累乗の余りを求める関数
    inline LLi power_mod(LLi a, LLi n, LLi mod_number___ = 1e9 + 7){
        LLi res = 1LL, waiting = a;
        while(n != 0LL){ if((n & 1LL) != 0LL){ res *= waiting; res %= mod_number___;}
            waiting *= waiting; waiting %= mod_number___; n >>= 1; }
        return res;
    }
    // Z/pZ上の逆元を求める関数 (フェルマーの小定理)
    inline LLi inverse_mod(LLi a, LLi mod_number___ = 1e9 + 7){
        return MyFunc::power_mod(a, mod_number___-2);
    }
    inline LLi inverse_mod_euclid(LLi a, LLi mod_number___ = 1e9+7){
        LLi b = mod_number___, u = 1, v = 0;
        while (b != 0) { LLi t = a / b; a -= t * b; std::swap(a, b);
            u -= t * v; std::swap(u, v);}
        u %= mod_number___; if (u < 0) u += mod_number___;
        return u;
    }
}

constexpr int mod = 1e9 + 7;
std::vector<int> X;

int main(void){
    int n; scanf("%d", &n);
    X.resize(n); REP(i, n) scanf("%d", &X[i]);
    lli res = 0;
    for(int x = 0; x < n - 1; ++x){
        lli p = MyFunc::inverse_mod(n - 1 - x);
        lli q = MyFunc::inverse_mod(x + 1);
        lli r = (p - q + mod) % mod;
        (res += r * X[x]) %= mod;

        // n-1との寄与
        (res += p * (X[n - 1] - X[x])) %= mod;
    }
    for(int x = 2; x < n; ++x) (res *= x) %= mod;

    printf("%lld\n", res);

    

    return 0;
}

Measured memory_bytes: 1144