#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll mod=1000000007;
ll fac[100010],revfac[100010],mul[100010],sum[100010],a[100010],ans;
int main()
{
    scanf("%d",&n);
    fac[0]=1;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",a+i);
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
    }
    revfac[n]=1;
    for(int i=n-1;i>0;i--)
    {
        revfac[i]=i*revfac[i+1];
        revfac[i]%=mod;
    }
    for(int i=1;i<n;i++)
    {
        mul[i]=fac[i-1]*revfac[i+1];
        mul[i]%=mod;
        sum[i]=sum[i-1]+mul[i];
        sum[i]%=mod;
    }
    for(int i=1;i<n;i++)
    {
        ans+=(a[i+1]-a[i])*sum[i];
        ans%=mod;
    }
    printf("%lld",ans);
}