//void __(){
//    _(int,n);
//    vl w(n+10);
//    w[1] = 0;
//    w[2] = 2;
//    w[3] = 9;
//    rep(ll,i,2,n+5){
//           w[i+2] = -((i*i%MOD*i+3*i*i+2*i)%MOD*w[i]+(-5*i-2*i*i-2)%MOD*w[i+1])%MOD*mod_inverse(i+1)%MOD;
//           if(w[i+1] < 0)
//               w[i+1] += MOD;
//
//
//    }
//    _(vl,a,n);
//    ll ans = 0;
//    Factorial f(n+1);
//    rep(i,n-1){
//        ans += w[i+2]*(a[i+1]-a[i])%MOD*f.ifact[i+2]%MOD;
//        ans %= MOD;
//    }
//    ans = ans*f.fact[n-1]%MOD;
//    print ans;
//
//}
//
#include <iomanip>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_ANY(type,i,l,r) for(type i = l; i <= r; ++i)
#define REP_ZERO_INT(i,r) for(int i = 0; i < r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
const ll MOD = 1e9 + 7;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
T1 istream& operator>>(istream& stream, vector<T>& t){
    return read(all(t), stream);
}
T1 istream& read(T b, T e, istream& stream){
    for(T it = b; it != e; ++it)
        stream >> *it;
    return stream;
}
T1 T ext_euclid(T a, T b, T c, T d){
    if(c == T(0))
        return b;
    return ext_euclid(c, d, a % c, b - a / c * d);
}
T1 T mod_inverse(T x, T mod = T(MOD)){
    return (ext_euclid(mod, T(0), x, T(1)) + mod) % mod;
}
ll mod_inverse(int x, ll mod = MOD){
    return mod_inverse<ll>(x,mod);
}
struct Factorial{
    vl fact,ifact;
    ll comb(ll n, ll m){
        assert(n >= m);
        assert(n < sz(fact));
        return fact[n]*ifact[m]%MOD*ifact[n-m]%MOD;
    }
    Factorial(int n){
        fact.resize(n+1);
        ifact.resize(n+1);
        fact[0] = 1;
        for(int i = 1; i <= n; ++i)
            fact[i] = fact[i-1]*i%MOD;
        ifact[n] = mod_inverse(fact[n]);
        for(int i = n-1; i >= 0; --i)
            ifact[i] = (i+1)*ifact[i+1]%MOD;
    }
};
struct _print {
    string sep,end;
    bool space;
    ostream &stream;
    _print(string _sep=" ",string _end="\n",
            ostream &_stream = cout)
        : sep(_sep),end(_end),space(false),
            stream(_stream) {}
    ~_print() { stream << end; }
    template <typename T>
        _print &operator , (const T &t) {
            if (space) stream << sep;
            space = true;
            stream << t;
            return *this;
        }
};
#define print _print(),
#define INPUT_WITHOUT_INIT(type,name) type name; cin >> name
#define _IWI(type,name,...) type name(__VA_ARGS__); cin >> name
#define GET_INPUT_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define _(...) GET_INPUT_MACRO(__VA_ARGS__,_IWI,_IWI,_IWI,_IWI,_IWI,_IWI,INPUT_WITHOUT_INIT)(__VA_ARGS__)
void __(){
    _(int,n);
    vl w(n+10);
    w[1] = 0;
    w[2] = 2;
    w[3] = 9;
    rep(ll,i,2,n+5){
           w[i+2] = -((i*i%MOD*i+3*i*i+2*i)%MOD*w[i]+(-5*i-2*i*i-2)%MOD*w[i+1])%MOD*mod_inverse(i+1)%MOD;
           if(w[i+1] < 0)
               w[i+1] += MOD;
    }
    _(vl,a,n);
    ll ans = 0;
    Factorial f(n+1);
    rep(i,n-1){
        ans += w[i+2]*(a[i+1]-a[i])%MOD*f.ifact[i+2]%MOD;
        ans %= MOD;
    }
    ans = ans*f.fact[n-1]%MOD;
    print ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        __();
}


Measured memory_bytes: 3456