//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=200023;
bool vis[N];
vector <int> adj[N];
ll factorialNumInverse[N + 1]; 
  
// array to precompute inverse of 1! to N! 
ll naturalNumInverse[N + 1]; 
  
// array to store factorial of first N numbers 
ll fact[N + 1]; 
  
// Function to precompute inverse of numbers 
void InverseofNumber(ll p) 
{ 
    naturalNumInverse[0] = naturalNumInverse[1] = 1; 
    for (int i = 2; i <= N; i++) 
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p; 
} 
// Function to precompute inverse of factorials 
void InverseofFactorial(ll p) 
{ 
    factorialNumInverse[0] = factorialNumInverse[1] = 1; 
  
    // precompute inverse of natural numbers 
    for (int i = 2; i <= N; i++) 
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p; 
} 
  
// Function to calculate factorial of 1 to N 
void factorial(ll p) 
{ 
    fact[0] = 1; 
  
    // precompute factorials 
    for (int i = 1; i <= N; i++) { 
        fact[i] = (fact[i - 1] * i) % p; 
    } 
} 
  
// Function to return nCr % p in O(1) time 
ll Binomial(ll N, ll R, ll p) 
{ 
    // n C r = n!*inverse(r!)*inverse((n-r)!) 
    ll ans = ((fact[N] * factorialNumInverse[R]) 
              % p * factorialNumInverse[N - R]) 
             % p; 
    return ans; 
} 
void solve()
{
    ll n;
    cin>>n;
    vl v;
    v.pb(0);
    ll fact[N];
    fact[0]=1;
    for(ll i=1;i<N;i++)
    {
        fact[i]=(fact[i-1]*i);
        fact[i]%=mod;
    }
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    ll dp[n+1]={0};
    dp[n]=0;
    for(int i=n-1;i>=1;i--)
    {
        //dp[i]
        ll add=0;
        for(int j=i+1;j<=n;j++)
        {
            ll temp;
            temp=(fact[j-i-1]);
            temp*=(fact[max((ll)0,n-j-1)]);
            temp%=mod;
            temp*=(Binomial(n-i,max((ll)0,n-j-1),mod));
            temp%=mod;
            // if(i==1 && j==3)
            // {
            //     cout<<temp<<'\n';
            // }
            temp*=(v[j]-v[i]);
            temp%=mod;
            // temp+=(fact[n-i]*dp[i+1]);
            // temp%=mod;
            add+=temp;
            add%=mod;
            // if(i==1)
            // cout<<temp<<'\n';
        }
        dp[i]=(dp[i+1]*(n-i));
        dp[i]%=mod;
        dp[i]+=add;
        dp[i]%=mod;
    }
    cout<<dp[1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    ll p = 1000000007; 
    InverseofNumber(p); 
    InverseofFactorial(p); 
    factorial(p); 
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}