#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

ll power(ll x,ll n)
{
    if(n==0){return 1;}
    if(n==1){return x;}
    if(n%2==0){
        return power((x*x)%M,n/2);
    }
    if(n%2==1){
        return (power((x*x)%M,n/2)*x)%M;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;
    cin>>n;
    ll ar[n];
    for(ll i=0;i<n;++i)
    {
        cin>>ar[i];
    }

    ll fac[n+1];
    fac[0]=1;
    for(ll i=1;i<=n;++i)
    {
        fac[i]=(i*fac[i-1])%M;
    }

    ll maths[n-1];
    for(ll i=0;i<n-1;++i)
    {
        maths[i]=(fac[n-1]*power(i+1,M-2))%M;
    }
    ll ans=0;
    for(ll i=0;i<n-1;++i)
    {
        ll ch=((ar[n-1]-ar[i])*maths[i])%M;
        ans=(ans+ch)%M;
    }
    cout<<ans;

    return (0);
}
