#include<cstdio>
const long long mod = 1e9+7;
long long x[100005];

long long pow(long long a,long long b){
    long long res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        a = a*a%mod;
        b /= 2;
    }
    return res;
}

long long inv(long long u){ return pow(u,mod-2); }

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++) scanf("%lld",&x[i]);
    long long ans = 0;
    long long count = 0;
    long long hold = 1;
    for(int i = 2; i <= n-1; i++) hold = hold*(long long)i%mod;
    //printf("hold = %lld\n",hold);
    for(int i = 1; i <= n-1; i++){
        count = (count + inv(i))%mod;
        //printf("i = %d, time = %lld\n",i,count*hold%mod);
        ans = (ans + count*(x[i+1]-x[i])%mod)%mod;
    }
    printf("%lld\n",ans*hold%mod);
    return 0;
}


