#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    ll N;
    cin>>N;
    vector<ll>X(N);
    rep(i,X){
        cin>>X.at(i);
    }
    ll ans=0;
    for(int i=0; i<N; i++){
        ll count=0;
        for(int j=0; j<N; j++){
            if(i==j){
            }
            else{
                count+=abs(X.at(j)-X.at(i));
                count%=1000000007;
            }
            ans+=count;
        }
    }
    fpr(int i=1; i<N+1; i++){
        ans*=i;
        ans%=1000000007;
    }
    cout<<ans<<endl;
}