#include<bits/stdc++.h>
using namespace std ;

#define ll long long
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll>
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{
    return os<<'('<<p.F<< ","<<p.S<<')';
}

const int MOD=1000000007;
struct Mint {
    int val;

    Mint(long long v = 0) {
        if (v < 0)
            v = v % MOD + MOD;
        if (v >= MOD)
            v %= MOD;
        val = v;
    }

    static int mod_inv(int a, int m = MOD) {
        int g = m, r = a, x = 0, y = 1;
        while (r != 0) {
            int q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }
        return x < 0 ? x + m : x;
    }
    explicit operator int() const {
        return val;
    }
    Mint& operator+=(const Mint &other) {
        val += other.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    Mint& operator-=(const Mint &other) {
        val -= other.val;
        if (val < 0) val += MOD;
        return *this;
    }
    static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
           #if !defined(_WIN32) || defined(_WIN64)
                return x % m;
           #endif
           unsigned x_high = x >> 32, x_low = (unsigned) x;
           unsigned quot, rem;
           asm("divl %4\n"
            : "=a" (quot), "=d" (rem)
            : "d" (x_high), "a" (x_low), "r" (m));
           return rem;
    }
    Mint& operator*=(const Mint &other) {
        val = fast_mod((uint64_t) val * other.val);
        return *this;
    }
    Mint& operator/=(const Mint &other) {
        return *this *= other.inv();
    }
    friend Mint operator+(const Mint &a, const Mint &b) { return Mint(a) += b; }
    friend Mint operator-(const Mint &a, const Mint &b) { return Mint(a) -= b; }
    friend Mint operator*(const Mint &a, const Mint &b) { return Mint(a) *= b; }
    friend Mint operator/(const Mint &a, const Mint &b) { return Mint(a) /= b; }
    Mint& operator++() {
        val = val == MOD - 1 ? 0 : val + 1;
        return *this;
    }
    Mint& operator--() {
        val = val == 0 ? MOD - 1 : val - 1;
        return *this;
    }
    Mint operator++(int32_t) { Mint before = *this; ++*this; return before; }
    Mint operator--(int32_t) { Mint before = *this; --*this; return before; }
    Mint operator-() const {
        return val == 0 ? 0 : MOD - val;
    }
    bool operator==(const Mint &other) const { return val == other.val; }
    bool operator!=(const Mint &other) const { return val != other.val; }
    Mint inv() const {
        return mod_inv(val);
    }
    Mint power(long long p) const {
        assert(p >= 0);
        Mint a = *this, result = 1;
        while (p > 0) {
            if (p & 1)
                result *= a;

            a *= a;
            p >>= 1;
        }
        return result;
    }
    friend ostream& operator << (ostream &stream, const Mint &m) {
        return stream << m.val;
    }
    friend istream& operator >> (istream &stream, Mint &m) {
        return stream>>m.val;
    }
};

#define NCR
const int NC=1000005;
ll inv[NC],fac_inv[NC],fac[NC];
void initialize()
{
    ll i;
    inv[1]=1;
    for(i=2;i<=NC-2;i++)
        inv[i]=(MOD-MOD/i)*inv[MOD%i]%MOD;
    fac[0]=fac[1]=1;
    for(i=2;i<=NC-2;i++)
        fac[i]=i*fac[i-1]%MOD;
    fac_inv[0]=fac_inv[1]=1;
    for(i=2;i<=NC-2;i++)
        fac_inv[i]=inv[i]*fac_inv[i-1]%MOD;
}
ll ncr(ll n,ll r)
{
    if(n<r) return 0;
    return (fac[n]*fac_inv[r]%MOD)*fac_inv[n-r]%MOD;
}

int _runtimeTerror_()
{
    int n;
    cin>>n;
    vector<ll> v(n);
    for(int i=0;i<n;++i)
        cin>>v[i];
    sort(all(v));
    Mint ans=0;
    for(int i=0;i<n;++i)
    {
        auto it=lower_bound(all(v),v[i])-v.begin();
        auto itt=upper_bound(all(v),v[i])-v.begin();
        if(itt==n)
            break;
        ans+=Mint(v[i])*fac[n]*Mint(n-it).inv();
    }
    cout<<ans;
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long fact[1000005], invfact[1000005];
long long bigmod(long long a, long long p){
    if(p == 0){
        return 1;
    }
    long long ans = bigmod(a, p/2);
    ans = (ans * ans) % mod;
    if(p % 2 == 1){
        ans = (ans * a) % mod;
    }
    return ans;
}
long long inverse(long long a){
    return bigmod(a, mod - 2);
}
void precalc(){
    fact[0] = 1, invfact[0] = 1;
    for(long long i = 1; i <= 1000000; i++){
        fact[i] = (fact[i - 1] * i) % mod;
        invfact[i] = inverse(fact[i]);
    }
}
long long nCr(long long n, long long r){
    long long val = (fact[n] * invfact[n - r]) % mod;
    return (val * invfact[r]) % mod;
}
int main(){
    precalc();
    int n;
    cin >> n;
    vector<long long>v(n);
    long long mx = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        mx = max(mx, v[i]);
    }
    sort(v.begin(), v.end());
    int l = 0, x = 0;
    long long ans = 0;
    for(int i = 0; i < n; i++){
        if(v[i] != x){
            l = i;
        }
        x = v[i];
        if(v[i] == mx){
            break;
        }
        long long cur = (v[i] * fact[l]) % mod;
        cur = (cur * fact[n - l - 1]) % mod;
        cur = (cur * nCr(n, n - l)) % mod;
        ans = (ans + cur) % mod;
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);

using namespace std;

const int maxn = (int)1e6 + 10;
const int maxM = (int)1.5e7 + 100;
const int mod = (int)1e9 + 7;
const int P = (int) 1e6 + 7;
const double pi = acos(-1.0);

#define inf mod

typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef array<int, 3> triple;

int n, f[maxn], inv[maxn], p[maxn];
int a[maxn], cnt[maxn];

int binpow(int a, int b){
  int res = 1;
  while(b){
    if(b & 1) res = (res * 1ll * a) % mod;
    a = (a * 1ll * a) % mod;
    b >>= 1;
  }
  return res;
}
int C(int n, int k){
  if(n < 0 || k < 0 || n < k) return 0;
  return (1ll * f[n] * inv[k] % mod) * 1ll * inv[n - k] % mod;
}
int sum(int a, int b){
  a += b;
  if(a >= mod) a -= mod;
  return a;
}
int get(int r, int x){
  return C(r + 1, x + 1);
}
int get(int l, int r, int x){
  return sum(get(r, x), mod - get(l - 1, x));
}
void solve(int T = 0){
  f[0] = inv[0] = 1;
  forn(i, 1, maxn - 1){
    f[i] = f[i - 1] * 1ll * i % mod;
    inv[i] = binpow(f[i], mod - 2);
  }
  scanf("%d", &n);
  map<int, int> c;
  forn(i, 1, n) scanf("%d", &a[i]), c[a[i]]++;
  sort(a + 1, a + n + 1);
  int res = 0;
  forn(i, 1, n - 1){
    if(a[i] == a[i + 1]) continue;
    int z = c[a[i]] - 1;
    int s = (f[n - i + z] * 1ll * f[i - 1 - z]) % mod;
    s = (s * 1ll * get(n - i, n - 1, n - i + z)) % mod;
    s = (s * 1ll * (z + 1)) % mod;
    s = (s * 1ll * a[i]) % mod;
    res = sum(res, s);
  }
  printf("%d", res);
}

main () {
  int t = 1;
  //scanf("%d", &t);
  forn(i, 1, t)
    solve(i);
}


#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);

using namespace std;

const int maxn = (int)1e6 + 10;
const int maxM = (int)1.5e7 + 100;
const int mod = (int)1e9 + 7;
const int P = (int) 1e6 + 7;
const double pi = acos(-1.0);

#define inf mod

typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef array<int, 3> triple;

int n, f[maxn], inv[maxn], p[maxn];
int a[maxn], cnt[maxn], c[maxn];

int binpow(int a, int b){
  int res = 1;
  while(b){
    if(b & 1) res = (res * 1ll * a) % mod;
    a = (a * 1ll * a) % mod;
    b >>= 1;
  }
  return res;
}
int C(int n, int k){
  if(n < 0 || k < 0 || n < k) return 0;
  return (1ll * f[n] * inv[k] % mod) * 1ll * inv[n - k] % mod;
}
int sum(int a, int b){
  a += b;
  if(a >= mod) a -= mod;
  return a;
}
int get(int r, int x){
  return C(r + 1, x + 1);
}
int get(int l, int r, int x){
  return sum(get(r, x), mod - get(l - 1, x));
}
void solve(int T = 0){
  f[0] = inv[0] = 1;
  forn(i, 1, maxn - 1){
    f[i] = f[i - 1] * 1ll * i % mod;
    inv[i] = binpow(f[i], mod - 2);
  }
  scanf("%d", &n);
  forn(i, 1, n) scanf("%d", &a[i]), c[a[i]]++;
  sort(a + 1, a + n + 1);
  int res = 0;
  forn(i, 1, n - 1){
    if(a[i] == a[i + 1]) continue;
    int z = c[a[i]] - 1;
    int s = (f[n - i + z] * 1ll * f[i - 1 - z]) % mod;
    s = (s * 1ll * get(n - i, n - 1, n - i + z)) % mod;
    s = (s * 1ll * (z + 1)) % mod;
    s = (s * 1ll * a[i]) % mod;
    res = sum(res, s);
  }
  printf("%d", res);
}

main () {
  int t = 1;
  //scanf("%d", &t);
  forn(i, 1, t)
    solve(i);
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
constexpr ll mod = 1e9+7;

struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

class combination{
private:
    vector<mint> fact,inv,finv;
public:
    combination(int N){
        fact = inv = finv = vector<mint>(N+1);
        fact[0] = fact[1] = 1;
        inv[0] = inv[1] = 1;
        finv[0] = finv[1] = 1;
        for(ll i=2;i<=N;i++){
            fact[i] = fact[i-1]*i;
            inv[i] = (mint) mod - inv[mod%i]*(mod/i);
            finv[i] = finv[i-1]*inv[i];
        }
    }
    mint f(int i){
        return fact[i];
    }
    mint comb(int n,int k){
        if(n<k) return 0;
        if(n<0 || k<0) return 0;
        return fact[n]*finv[k]*finv[n-k];
    }
    mint hcomb(int n,int k){
        if(n==0 && k==0) return 1;
        return comb(n+k-1,k);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N+1);
    combination C(N);
    map<ll,ll> mp;
    int ma = 0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A.begin()+1,A.end());
    vec<mint> fact(N+1,1);
    for(ll i=1;i<=N;i++) fact[i] = fact[i-1]*i;
    mint ans = 0;
    int p = -1;
    for(int i=1;i<=N-1;i++){
        if(p==A[i] || A[i]==A[N]) continue;
        ans += fact[i-1]*fact[N-i]*C.comb(N,i-1)*A[i]*mp[A[i]];
        p = A[i];
    }
    cout << ans.x << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
constexpr ll mod = 1e9+7;

struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

class combination{
private:
    vector<mint> fact,inv,finv;
public:
    combination(int N){
        fact = inv = finv = vector<mint>(N+1);
        fact[0] = fact[1] = 1;
        inv[0] = inv[1] = 1;
        finv[0] = finv[1] = 1;
        for(ll i=2;i<=N;i++){
            fact[i] = fact[i-1]*i;
            inv[i] = (mint) mod - inv[mod%i]*(mod/i);
            finv[i] = finv[i-1]*inv[i];
        }
    }
    mint f(int i){
        return fact[i];
    }
    mint comb(int n,int k){
        if(n<k) return 0;
        if(n<0 || k<0) return 0;
        return fact[n]*finv[k]*finv[n-k];
    }
    mint hcomb(int n,int k){
        if(n==0 && k==0) return 1;
        return comb(n+k-1,k);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N+1);
    combination C(N);
    map<ll,ll> mp;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A.begin()+1,A.end());
    vec<mint> fact(N+1,1);
    for(ll i=1;i<=N;i++) fact[i] = fact[i-1]*i;
    mint ans = 0;
    int p = -1;
    for(int i=1;i<=N-1;i++){
        if(p==A[i]) continue;
        mint res = 0;
        for(int j=1;j<=i;j++) res += fact[N-j]*fact[i-j].inv();
        ans += res*fact[i-1]*A[i]*mp[A[i]];
        p = A[i];
    }
    cout << ans.x << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
constexpr ll mod = 1e9+7;

struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

class combination{
private:
    vector<mint> fact,inv,finv;
public:
    combination(int N){
        fact = inv = finv = vector<mint>(N+1);
        fact[0] = fact[1] = 1;
        inv[0] = inv[1] = 1;
        finv[0] = finv[1] = 1;
        for(ll i=2;i<=N;i++){
            fact[i] = fact[i-1]*i;
            inv[i] = (mint) mod - inv[mod%i]*(mod/i);
            finv[i] = finv[i-1]*inv[i];
        }
    }
    mint f(int i){
        return fact[i];
    }
    mint comb(int n,int k){
        if(n<k) return 0;
        if(n<0 || k<0) return 0;
        return fact[n]*finv[k]*finv[n-k];
    }
    mint hcomb(int n,int k){
        if(n==0 && k==0) return 1;
        return comb(n+k-1,k);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N+1);
    combination C(N);
    map<ll,ll> mp;
    int ma = 0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A.begin()+1,A.end());
    vec<mint> fact(N+1,1);
    for(ll i=1;i<=N;i++) fact[i] = fact[i-1]*i;
    mint ans = 0;
    int p = -1;
    for(int i=1;i<=N-1;i++){
        if(p==A[i] || A[i]==A[N]) continue;
        mint res = 0;
        for(int j=1;j<=i;j++) res += fact[N-j]*fact[i-j].inv();
        ans += res*fact[i-1]*A[i]*mp[A[i]];
        p = A[i];
    }
    cout << ans.x << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
constexpr ll mod = 1e9+7;

struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N+1);
    map<ll,ll> mp;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A.begin()+1,A.end());
    vec<mint> fact(N+1,1),S(N+1,0);
    for(ll i=1;i<=N;i++) fact[i] = fact[i-1]*i;
    for(int i=1;i<=N;i++) S[i] = S[i-1]+fact[N-i]*fact[i-1];
    mint ans = 0;
    int p = -1;
    for(int i=1;i<=N-1;i++){
        if(p==A[i]) continue;
        ans += S[i]*mp[A[i]]*A[i];
        p = A[i];
    }
    cout << ans.x << endl;
}


//https://codeforces.com/contest/938/problem/E
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6+10;
const ll mod = 1e9+7;
ll ifct[N],fct[N],inv[N],n,arr[N],ans,prv;
void pre(){
    fct[0] = fct[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < N; ++i)fct[i]=i*fct[i-1]%mod,inv[i] = (mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(ll i = 2; i < N; ++i)ifct[i]=inv[i]*ifct[i-1]%mod;
}
ll ncr(ll n, ll r){
    if(r > n || r < 0)return 0;
    return fct[n]*ifct[n-r]%mod*ifct[r]%mod;
}
int main(){
    pre();
    scanf("%lld",&n);
    for(int i = 1; i <= n; ++i)scanf("%lld",arr+i);
    sort(arr+1,arr+n+1);
    for(int i = 1; i < n; ++i){
        if(arr[i] == arr[i-1]){ans+=prv; continue;}
        prv = 0;
        for(int j = 1; j <= i; ++j)prv=(prv + ncr(i-1,j-1)*fct[j-1]%mod*fct[n-j]%mod)%mod;
        prv = (prv*arr[i])%mod;
        ans = (ans+prv)%mod;
    }
    return printf("%lld\n",ans),0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
const long long mod = 1e9+7;
// const long long mod = 998244353;
using namespace std;
// DEBUGGER
// *
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
// *
// DEBUGGER

#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define mp make_pair
#define pb emplace_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
#define sz(x) (int)((x).size())
#define square(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define distance(a,b,c,d) ((a-c)*1LL*(a-c)+(b-d)*1LL*(b-d))
#define range(i,x,y) ((x <= i) && (i <= y))
#define SUM(a) accumulate(a.begin(),a.end(),0LL)
#define lb lower_bound
#define ub upper_bound
#define REV reverse
#define seive(N) int pr[N]; void preSieve(){for(int i = 2; i < N; ++i){if(!pr[i])for(int j = i; j < N; j+=i)pr[j]=i;}}
#define modInv(N) ll inv[N]; void preModInv(){inv[0]=1;inv[1]=1;for(int i = 2; i < N; ++i)inv[i] = mod-mod/i*inv[mod%i]%mod;}
#define fact(N) ll fact[N]; void preFact(){fact[0] = 1,fact[1] = 1; for(int i = 2; i < N; ++i)fact[i]=fact[i-1]*i%mod;}
#define inFact(N) ll ifact[N]; void preiFact(){ifact[0] = 1;ifact[1] = 1; for(int i = 2; i < N; ++i)ifact[i]=ifact[i-1]*inv[i]%mod;}
// pair operation
template<class T, class U>istream& operator>>(istream& in, pair<T,U> &rhs){in >> rhs.first;in >> rhs.second;return in;}
template<class T, class U>ostream& operator<<(ostream& out,const pair<T,U> &rhs){out << rhs.first;out << " ";out << rhs.second;return out;}
template<class T, class U>pair<T,U> operator+(pair<T,U> &a, pair<T,U> &b){return pair<T,U>(a.first+b.first,a.second+b.second);}
template<class T, class U>pair<T,U> operator-(pair<T,U> &a, pair<T,U> &b){return pair<T,U>(a.first-b.first,a.second-b.second);}
// Linear STL
// VECTOR
template<class T>istream& operator>>(istream& in, vector<T> &a){for(auto &i: a)cin >> i;return in;}
template<class T>ostream& operator<<(ostream& out, const vector<T> &a){for(auto &i: a)cout << i << " ";return out;}
// SET
template<class T>ostream& operator<<(ostream& out, const set<T> &a){for(auto &i: a)cout << i << " ";return out;}
template<class T>ostream& operator<<(ostream& out, const unordered_set<T> &a){for(auto &i: a)cout << i << " ";return out;}
template<class T>ostream& operator<<(ostream& out, const multiset<T> &a){for(auto &i: a)cout << i << " ";return out;}
// MAP
template<class T,class U>ostream& operator<<(ostream& out, const map<T,U> &a){for(auto &i: a)cout << "(" << i.first << ", " << i.second << ")\n";return out;}
template<class T,class U>ostream& operator<<(ostream& out, const unordered_map<T,U> &a){for(auto &i: a)cout << "(" << i.first << ", " << i.second << ")\n";return out;}

// using namespace __gnu_pbds;
// template <typename T>
// using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const long long N = 1e6 + 100;
const long long inf = 1e9;
const long double pi = acos(-1);

modInv(N)
fact(N)
inFact(N)
ll coeff;
ll ncr(ll n, ll r){
	if(r < 0 || r > n)return 0;
	ll val = fact[n]*ifact[r]%mod*ifact[n-r]%mod;
	debug(n,r,val,fact[n],ifact[r],ifact[n-r]);
	return val;
}
ll a[N];
void solve(int test_case){
	ll n;
	cin >> n;
	if(n == 1){cout << 0; return;}
	loop(i,0,n)cin >> a[i];
	sort(a,a+n);
	if(n == 2){
		if(a[1] == a[0]){cout << 0; return;}
		cout << a[0] << "\n";
		return;
	}
	for(ll i = 1; i < n; ++i){
		ll left = i-1;
		ll right = n-(i+1);
		coeff = (coeff + ncr(n-2,right)*fact[i-1]%mod*fact[right]%mod)%mod;
		debug(coeff,i,i-1,right);
	}
	debug(coeff);
	ll ans = 0;
	loop(i,0,n){
		ll k = n-(ub(a,a+n,a[i])-a);
		ans = (ans + k*coeff%mod)%mod;
	}
	cout << ans;
}

int main(){
	FAST
	preModInv();
	preFact();
	preiFact();
	// cout << fact[10] << "\n";
	// cout << inv[10] << "\n";
	// cout << ifact[10] << "\n";
	int t = 1;
	// cin >> t;
	loop(i,1,t+1)solve(i);
}


//https://codeforces.com/contest/938/problem/E
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6+10;
const ll mod = 1e9+7;
ll ifct[N],fct[N],inv[N],n,arr[N],ans,prv;
void pre(){
    ifct[1] = ifct[0] = fct[0] = fct[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < N; ++i)fct[i]=i*fct[i-1]%mod,inv[i] = (mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(ll i = 2; i < N; ++i)ifct[i]=inv[i]*ifct[i-1]%mod;
}
ll ncr(ll n, ll r){
    if(r > n || r < 0)return 0;
    return fct[n]*ifct[n-r]%mod*ifct[r]%mod;
}
int main(){
    pre();
    scanf("%lld",&n);
    for(int i = 1; i <= n; ++i)scanf("%lld",arr+i);
    sort(arr+1,arr+n+1);
    for(int i = 1; arr[i] < arr[n]; ++i){
        if(arr[i] == arr[i-1]){ans+=prv; continue;}
        prv = ncr(n,n-i+1)*fct[i-1]%mod*fct[n-i]%mod;
        prv = (prv*arr[i])%mod;
        ans = (ans+prv)%mod;
    }
    return printf("%lld\n",ans),0;
}


//https://codeforces.com/contest/938/problem/E
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6+10;
const ll mod = 1e9+7;
ll ifct[N],fct[N],inv[N],n,arr[N],ans,prv;
void pre(){
    ifct[1] = ifct[0] = fct[0] = fct[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < N; ++i)fct[i]=i*fct[i-1]%mod,inv[i] = (mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(ll i = 2; i < N; ++i)ifct[i]=inv[i]*ifct[i-1]%mod;
}
ll ncr(ll n, ll r){
    if(r > n || r < 0)return 0;
    return fct[n]*ifct[n-r]%mod*ifct[r]%mod;
}
int main(){
    pre();
    scanf("%lld",&n);
    for(int i = 1; i <= n; ++i)scanf("%lld",arr+i);
    sort(arr+1,arr+n+1);
    for(int i = 1; arr[i] < arr[n]; ++i){
        if(arr[i] == arr[i-1]){ans=(ans+prv)%mod; continue;}
        prv = ncr(n,n-i+1)*fct[i-1]%mod*fct[n-i]%mod;
        prv = (prv*arr[i])%mod;
        ans = (ans+prv)%mod;
    }
    return printf("%lld\n",ans),0;
}


//https://codeforces.com/contest/938/problem/E
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6+10;
const ll mod = 1e9+7;
ll ifct[N],fct[N],inv[N],n,arr[N],ans,prv;
void pre(){
    ifct[1] = ifct[0] = fct[0] = fct[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < N; ++i)fct[i]=i*fct[i-1]%mod,inv[i] = (mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(ll i = 2; i < N; ++i)ifct[i]=inv[i]*ifct[i-1]%mod;
}
ll ncr(ll n, ll r){
    if(r > n || r < 0)return 0;
    return fct[n]*ifct[n-r]%mod*ifct[r]%mod;
}
int main(){
    pre();
    scanf("%lld",&n);
    for(int i = 1; i <= n; ++i)scanf("%lld",arr+i);
    sort(arr+1,arr+n+1);
    for(int i = 1; i < n; ++i){
        if(arr[i] == arr[i-1]){ans+=prv; continue;}
        prv = 0;
        for(int j = 1; j <= i; ++j)prv=(prv + ncr(i-1,j-1)*fct[j-1]%mod*fct[n-j]%mod)%mod;
        prv = (prv*arr[i])%mod;
        ans = (ans+prv)%mod;
    }
    return printf("%lld\n",ans),0;
}


//https://codeforces.com/contest/938/problem/E
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int N = 1e6+10;
const ll mod = 1e9+7;
ll ifct[N],fct[N],inv[N],n,arr[N],ans,prv;
void pre(){
    ifct[1] = ifct[0] = fct[0] = fct[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < N; ++i)fct[i]=i*fct[i-1]%mod,inv[i] = (mod-(mod/i)*inv[mod%i]%mod)%mod;
    for(ll i = 2; i < N; ++i)ifct[i]=inv[i]*ifct[i-1]%mod;
}
ll ncr(ll n, ll r){
    if(r > n || r < 0)return 0;
    return fct[n]*ifct[n-r]%mod*ifct[r]%mod;
}
int main(){
    pre();
    scanf("%lld",&n);
    for(int i = 1; i <= n; ++i)scanf("%lld",arr+i);
    sort(arr+1,arr+n+1);
    for(int i = 1; arr[i] < arr[n]; ++i){
        if(arr[i] == arr[i-1]){ans+=prv; continue;}
        prv = 0;
        for(int j = 1; j <= i; ++j)prv=(prv + ncr(i-1,j-1)*fct[j-1]%mod*fct[n-j]%mod)%mod;
        prv = (prv*arr[i])%mod;
        ans = (ans+prv)%mod;
    }
    return printf("%lld\n",ans),0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define pb push_back
#define pp pop_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define sz(s) s.size()
#define fi first
#define se second
#define cl clear

const int maxn = 3 * 1000 * 1000 + 10;
const ll mod = 1000 * 1000 * 1000 + 7;
const ll inf = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;

ll pw(ll a, ll b){
    return (b == 0 ? 1LL : ((pw(a * a % mod, b / 2) * (b & 1 == 1 ? a : 1LL)) % mod));
}
ll comb(ll n, ll k){
    ll _max = max(k, n - k), _min = min(k, n - k), f = 1, s = 1;
    for(int i = 0; i < n - _max; i++){f *= n - i; f %= mod;}
    for(int i = 1; i <= _min; i++){s *= i; s %= mod;}
    return ((f * pw(s, mod - 2)) % mod);
}
ll ar[maxn], fact[maxn];
vector <pair<ll, ll> > arr;

int main ()
{
    //cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    ll n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    for(int i = 0; i < n; i++){
        if(!arr.empty() and ar[i] == arr.back().fi){
            ll a = arr.back().se + 1;
            arr.pp();
            arr.pb(mp(ar[i], a));
        }
        else arr.pb(mp(ar[i], 1));
    }
    ll m = arr.size();
    fact[0] = 1;
    for(int i = 1; i <  maxn; i++) fact[i] = (fact[i - 1] * i) % mod;
    for(int i = 0; i < m - 1; i++){
        ll a = (fact[n] * pw(fact[n - i], mod - 2)) % mod;
        a *= fact[n - i - 1];
        a %= mod;
        a *= fact[i];
        a %= mod;
        a *= arr[i].fi * arr[i].se % mod;
        a %= mod;
        ans += a;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define pb push_back
#define pp pop_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define sz(s) s.size()
#define fi first
#define se second
#define cl clear

const int maxn = 3 * 1000 * 1000 + 10;
const ll mod = 1000 * 1000 * 1000 + 7;
const ll inf = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;

ll pw(ll a, ll b){
    return (b == 0 ? 1LL : ((pw(a * a % mod, b / 2) * (b & 1 == 1 ? a : 1LL)) % mod));
}
ll comb(ll n, ll k){
    ll _max = max(k, n - k), _min = min(k, n - k), f = 1, s = 1;
    for(int i = 0; i < n - _max; i++){f *= n - i; f %= mod;}
    for(int i = 1; i <= _min; i++){s *= i; s %= mod;}
    return ((f * pw(s, mod - 2)) % mod);
}
ll ar[maxn], fact[maxn];
vector <pair<ll, ll> > arr;

int main ()
{
    //cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    ll n, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    for(int i = 0; i < n; i++){
        if(!arr.empty() and ar[i] == arr.back().fi){
            ll a = arr.back().se + 1;
            arr.pp();
            arr.pb(mp(ar[i], a));
        }
        else arr.pb(mp(ar[i], 1));
    }
    ll m = arr.size();
    fact[0] = 1;
    ll cnt = 0;
    for(int i = 1; i <  maxn; i++) fact[i] = (fact[i - 1] * i) % mod;
    for(int i = 0; i < m - 1; i++){
        ll a = (fact[n] * pw(fact[n - cnt] * fact[cnt] % mod, mod - 2)) % mod;
        a *= fact[n - cnt - 1];
        a %= mod;
        a *= fact[cnt];
        a %= mod;
        a *= arr[i].fi * arr[i].se % mod;
        a %= mod;
        ans += a;
        ans %= mod;
        cnt += arr[i].se;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

#pragma GCC optimize("O3")

using namespace std;

#define MAXN 1000005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOBIR(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define JaydenXia(in, out) \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long

typedef set<int> si;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
#define f first
#define s second

const ll MOD = (ll)(1e9+7);
ll n, arr[MAXN], fact1[MAXN], fact2[MAXN];

ll wow(int ind)
{
    return fact1[n-ind-1] * fact2[n-ind+1] % MOD;
}

int main()
{
    cin >> n;
    FOBIR(i, n)
    {
        cin >> arr[i];
    }
    sort(arr+1, arr+1+n);
    fact1[0] = fact2[n+1] = 1;
    FOBIR(i, n)
    {
        fact1[i] = (fact1[i-1] * i) % MOD;
        fact2[n-i+1] = (fact2[n-i+2] * i) % MOD;
    }
    ll ok = 0;
    ll ko = 0;
    ll fuck = 0;
    FOBIR(i, n)
    {
        if(arr[i] == arr[n]) continue;
        if(arr[i] == arr[i-1]) ok++;
        else
        {
            ko += ok;
            ok = 1;
        }
        fuck = (fuck + (wow(ko) * arr[i]) % MOD) % MOD;
    }
    cout << fuck << endl;
}


#include <bits/stdc++.h>

#pragma GCC optimize("O3")

using namespace std;

#define MAXN 1000005

#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORR(j, i, n) for (int i = j; i < n; i++)
#define FORD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOBIRD(i, n) for (int i = n; i > 0; i--)
#define FOBIR(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define endl '\n'
#define DUEHOANG                  \
	ios_base::sync_with_stdio(0); \
	cin.tie(NULL);                \
	cout.tie(NULL)

#define JaydenXia(in, out) \
	freopen(in, "r", stdin); \
	freopen(out, "w", stdout);

#define ll long long

typedef set<int> si;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef priority_queue<int> pqi;
typedef stack<int> sti;
typedef queue<int> qi;
typedef deque<int> di;
typedef map<int, int> mii;
#define f first
#define s second

const ll MOD = (ll)(1e9+7);
ll n, arr[MAXN], fact1[MAXN], fact2[MAXN];

ll wow(int ind)
{
    return fact1[n-ind-1] * fact2[n-ind+1] % MOD;
}

int main()
{
    DUEHOANG;
    cin >> n;
    FOBIR(i, n)
    {
        cin >> arr[i];
    }
    sort(arr+1, arr+1+n);
    fact1[0] = fact2[n+1] = 1;
    FOBIR(i, n)
    {
        fact1[i] = (fact1[i-1] * i) % MOD;
    }
    FOBIRD(i, n)
    {
        fact2[i] = (fact2[i+1] * i) % MOD;
    }
    ll ok = 0;
    ll ko = 0;
    ll fuck = 0;
    FOBIR(i, n)
    {
        if(arr[i] == arr[n]) break;
        if(arr[i] == arr[i-1]) ok++;
        else
        {
            ko += ok;
            ok = 1;
        }
        fuck = (fuck + (wow(ko) * arr[i]) % MOD) % MOD;
    }
    cout << fuck << endl;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
ll inv(ll x){
    return pow_mod(x,mod-2);
}
ll fact_mod[1000006];
void solve()
{
  ll n;
  cin>>n;

  ll a[n];

  for(ll i=0;i<n;i++)
  cin>>a[i];

  sort(a,a+n);

  ll ans=0;

  for(ll i=0;i<n;i++){

      if(a[i]==a[n-1])

      continue;

      auto it=lower_bound(a,a+n,a[i]);

      ll pos=it-a;

      ll res=a[i];

      res%=mod;

       res*=inv(n-pos);

       res%=mod;

      res*=fact_mod[n];

      res%=mod;

      ans+=res;

      ans%=mod;
  }

  cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);

//Start from Here.

  ll t;
  t=1;
 // cin>>t;

 fact_mod[0]=1;
 fact_mod[1]=1;

 for(ll i=2;i<1000006;i++)
 fact_mod[i]=(i*fact_mod[i-1])%mod;

  while(t--)
  solve();

//Good Bye!
    return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6+6, MOD = 1e9+7;
int n, a[N];

int inv(int k) {
    int res = 1;
    for(int p=MOD-2; p; p>>=1) {
        if(p&1)
            (res *= k) %= MOD;
        (k *= k) %= MOD;
    }
    return res;
}

main() {
    cin >> n;
    int f = 1;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        (f *= i+1) %= MOD;
    }
    int ans = 0;
    sort(a, a+n);
    for(int i=0; i<n; i++) {
        int k = lower_bound(a, a+n, a[i]) - a;
        if(k == n-1) break;
        (ans += a[i] * inv(n-k)) %= MOD;
    }
    (ans *= f) %= MOD;
    cout << ans;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6+6, MOD = 1e9+7;
int n, a[N];

int inv(int k) {
    int res = 1;
    for(int p=MOD-2; p; p>>=1) {
        if(p&1)
            (res *= k) %= MOD;
        (k *= k) %= MOD;
    }
    return res;
}

main() {
    cin >> n;
    int f = 1;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        (f *= i+1) %= MOD;
    }
    int ans = 0;
    sort(a, a+n);
    for(int i=0; i<n; i++) {
        if(a[i] == a[n-1]) break;
        int k = lower_bound(a, a+n, a[i]) - a;
        (ans += a[i] * inv(n-k)) %= MOD;
    }
    (ans *= f) %= MOD;
    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N, A[1000000];
    cin >> N;
    map<int, int> mp;
    for(int i=0; i<N; i++){
        scanf("%d", &A[i]);
        mp[A[i]]++;
    }
    create_mod_tables(N);
    int64_t ans = 0;
    int done = 0;
    for(auto& p : mp){
        int v = p.first, num = p.second;
        int yet = N - done - num;
        if(yet) add(ans, v * inv_mod(yet+num) % MOD * num % MOD * fact[N]);
        done += num;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N, A[1000000];
    cin >> N;
    map<int, int> mp;
    for(int i=0; i<N; i++){
        scanf("%d", &A[i]);
        mp[A[i]]++;
    }
    create_mod_tables(N);
    int64_t ans = 0;
    int done = 0;
    for(auto& p : mp){
        int v = p.first, num = p.second;
        int yet = N - done - num;
        if(yet) add(ans, v * fact[done] % MOD * fact[yet+num-1] % MOD * num);
        done += num;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N=1e6+5;
const int MOD=1e9+7;

int n;
int a[N], fact[N], invfact[N];
map<int, int> m;
vector<pair<int, int> > v;

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	invfact[0]=invfact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
		invfact[i]=modinv(fact[i]);
	}
}

int32_t main()
{
    IOS;
    precompute();
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	m[a[i]]++;
    }
    for(auto it:m)
    	v.push_back(it);
    v.pop_back();
    int ans=0;
    int smaller=0;
    for(int i=0;i<v.size();i++)
    {
    	int temp=0;
    	for(int j=0;j<=smaller;j++)
    	{
    		int cur=fact[n-(j+1)];
    		cur*=fact[smaller];
    		cur%=MOD;
    		cur*=invfact[smaller-j];
    		cur%=MOD;
    		temp+=cur;
    		temp%=MOD;
    	}
    	temp*=v[i].first;
    	temp%=MOD;
    	temp*=v[i].second;
    	temp%=MOD;
    	smaller+=v[i].second;
    	ans+=temp;
    	ans%=MOD;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N=1e6+5;
const int MOD=1e9+7;

int n;
int a[N], fact[N], invfact[N];
map<int, int> m;
vector<pair<int, int> > v;

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	invfact[0]=invfact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
		invfact[i]=modinv(fact[i]);
	}
}

int32_t main()
{
    IOS;
    precompute();
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	m[a[i]]++;
    }
    for(auto it:m)
    	v.push_back(it);
    v.pop_back();
    int ans=0;
    int smaller=0;
    for(int i=0;i<v.size();i++)
    {
    	//Probability logic: The probability of atleast one of the occurences of current element (u) being present before all the larger elements (v) = u/(u+v)
    	int probability=v[i].second;
    	probability*=modinv(n-smaller);
    	probability%=MOD;
    	int contribution=fact[n] * v[i].first;
    	contribution%=MOD;
    	int temp=probability*contribution;
    	temp%=MOD;
    	smaller+=v[i].second;
    	ans+=temp;
    	ans%=MOD;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N=1e6+5;
const int MOD=1e9+7;

int n;
int a[N], fact[N], invfact[N];
map<int, int> m;
vector<pair<int, int> > v;

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	invfact[0]=invfact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
		invfact[i]=modinv(fact[i]);
	}
}

int32_t main()
{
    IOS;
    precompute();
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	m[a[i]]++;
    }
    for(auto it:m)
    	v.push_back(it);
    v.pop_back();
    int ans=0;
    int smaller=0;
    for(int i=0;i<v.size();i++)
    {
    	//Optimising the calculation as per editorial
    	int temp=fact[n];
    	temp*=v[i].first;
    	temp%=MOD;
    	temp*=modinv(n-smaller);
    	temp%=MOD;
    	temp*=v[i].second;
    	temp%=MOD;
    	smaller+=v[i].second;
    	ans+=temp;
    	ans%=MOD;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)

using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 1200000
#define offset
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll fact[tam],arr[tam];
ll pot(ll base,ll exp)
{
    ll res=1;
    base%=MOD;
    while(exp)
    {
        if (exp&1)
            res*=base,res%=MOD;
        base*=base,base%=MOD;
        exp/=2;
    }
    return res;
}
int  main()
{
    fact[0]=1;
    forr(i,1,tam)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
    //cout<<fact[3]<<endl;
    int n;
    cin>>n;
    map<int,int> cant;
    set<int> s;
    forr(i,0,n)
    {
        cin>>arr[i];
        cant[arr[i]]++;
        s.insert(arr[i]);
    }
    ll formas=0,menores=0;
    for(auto ite=s.begin();ite!=s.end();ite++)
    {
        ite++;
        if (ite==s.end())break;
        ite--;
        formas+=(((fact[n]*cant[*ite])%MOD)*pot(n-menores,MOD-2))%MOD*(*ite);
        formas%=MOD;
        menores+=cant[*ite];

    }
    cout<<formas<<endl;
}
// PLUS ULTRA!


#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)

using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 2000
#define offset
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll fact[tam],arr[tam];
ll pot(ll base,ll exp)
{
    ll res=1;
    base%=MOD;
    while(exp)
    {
        if (exp&1)
            res*=base,res%=MOD;
        base*=base,base%=MOD;
        exp/=2;
    }
    return res;
}
int  main()
{
    fact[0]=1;
    forr(i,1,tam)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
    //cout<<fact[3]<<endl;
    int n;
    cin>>n;
    map<int,int> cant;
    set<int> s;
    forr(i,0,n)
    {
        cin>>arr[i];
        cant[arr[i]]++;
        s.insert(arr[i]);
    }
    ll formas=0,menores=0;
    for(auto ite=s.begin();ite!=s.end();ite++)
    {

        formas+=((fact[n]*cant[*ite])%MOD)*pot(n-menores,MOD-2);
        formas%=MOD;
        menores+=cant[*ite];
        ite++;
        if (ite==s.end())break;
    }
    cout<<formas<<endl;
}
// PLUS ULTRA!


#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)

using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 1200000
#define offset
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll fact[tam],arr[tam];
ll pot(ll base,ll exp)
{
    ll res=1;
    base%=MOD;
    while(exp)
    {
        if (exp&1)
            res*=base,res%=MOD;
        base*=base,base%=MOD;
        exp/=2;
    }
    return res;
}
int  main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    fact[0]=1;
    forr(i,1,tam)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
    //cout<<fact[3]<<endl;
    int n;
    cin>>n;
    map<int,int> cant;
    set<int> s;
    forr(i,0,n)
    {
        cin>>arr[i];
        cant[arr[i]]++;
        s.insert(arr[i]);
    }
    ll formas=0,menores=0;
    for(auto ite=s.begin();ite!=s.end();ite++)
    {
        ite++;
        if (ite==s.end())break;
        ite--;
        formas+=(((fact[n]*cant[*ite])%MOD)*pot(n-menores,MOD-2))%MOD*(*ite);
        formas%=MOD;
        menores+=cant[*ite];

    }
    cout<<formas<<"\n";
}
// PLUS ULTRA!


#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)

using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 2000
#define offset
const ll MOD= 1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll fact[tam],arr[tam];
ll pot(ll base,ll exp)
{
    ll res=1;
    base%=MOD;
    while(exp)
    {
        if (exp&1)
            res*=base,res%=MOD;
        base*=base,base%=MOD;
        exp/=2;
    }
    return res;
}
int  main()
{
    fact[0]=1;
    forr(i,1,tam)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
    //cout<<fact[3]<<endl;
    int n;
    cin>>n;
    map<int,int> cant;
    set<int> s;
    forr(i,0,n)
    {
        cin>>arr[i];
        cant[arr[i]]++;
        s.insert(arr[i]);
    }
    ll formas=0,menores=0;
    for(auto ite=s.begin();ite!=s.end();ite++)
    {
        ite++;
        if (ite==s.end())break;
        ite--;
        formas+=(((fact[n]*cant[*ite])%MOD)*pot(n-menores,MOD-2))%MOD*(*ite);
        formas%=MOD;
        menores+=cant[*ite];

    }
    cout<<formas<<endl;
}
// PLUS ULTRA!


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1000001;
const ll MOD = (ll)1e9 + 7LL;

ll fat[N], inv[N];

inline ll addMod(ll a, ll b, ll md = MOD) {
  a += b;
  if(a >= md) a -= md;
  return a;
}

inline ll mulMod(ll a, ll b, ll md = MOD) {
  return (a * b) % md;
}

inline ll subMod(ll a, ll b, ll md = MOD) {
  a -= b;
  while(a < 0) a += md;
  return a;
}

inline ll powMod(ll x, ll p) {
  ll ans = 1;
  while(p) {
    if(p & 1) ans = mulMod(ans, x);
    p >>= 1;
    x = mulMod(x, x);
  }
  return ans;
}

inline void preprocess() {
  fat[0] = inv[0] = 1;
  for(int i = 1; i < N; ++i) {
    fat[i] = mulMod(fat[i - 1], i);
    inv[i] = powMod(i, MOD - 2);
  }
}

int main() {
  preprocess();
  int n; scanf("%d", &n);
  map< int, int > c;
  for(int i = 0; i < n; ++i) {
    int x; scanf("%d", &x);
    c[x]++;
  }
  int small = 0;
  ll ans = 0;
  ll lst = 0;
  for(auto it : c) {
    int larger = n - small;
    ll foo = it.first;
    foo = mulMod(foo, fat[n]);
    foo = mulMod(foo, it.second);
    foo = mulMod(foo, inv[larger]);
    ans = addMod(ans, foo);
    small += it.second;
    lst = it.first;
  }
  ans = subMod(ans, mulMod(fat[n], lst));
  printf("%lld\n", ans);
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1000001;
const ll MOD = (ll)1e9 + 7LL;

ll fat[N], inv[N];

inline ll addMod(ll a, ll b, ll md = MOD) {
  return (a + b) % md;
}

inline ll mulMod(ll a, ll b, ll md = MOD) {
  return (a * b) % md;
}

inline ll subMod(ll a, ll b, ll md = MOD) {
  a -= b;
  while(a < 0) a += md;
  return a;
}

inline ll powMod(ll x, ll p) {
  ll ans = 1;
  while(p) {
    if(p & 1) ans = mulMod(ans, x);
    p >>= 1;
    x = mulMod(x, x);
  }
  return ans;
}

inline void preprocess() {
  fat[0] = inv[0] = 1;
  for(int i = 1; i < N; ++i) {
    fat[i] = mulMod(fat[i - 1], i);
    inv[i] = powMod(i, MOD - 2);
  }
}

int main() {
  preprocess();
  int n; scanf("%d", &n);
  map< int, int > c;
  for(int i = 0; i < n; ++i) {
    int x; scanf("%d", &x);
    c[x]++;
  }
  int small = 0;
  ll ans = 0;
  ll lst = 0;
  for(auto it : c) {
    int larger = n - small;
    ll foo = it.first;
    foo = mulMod(foo, fat[n]);
    foo = mulMod(foo, it.second);
    foo = mulMod(foo, inv[larger]);
    ans = addMod(ans, foo);
    small += it.second;
    lst = it.first;
  }
  ans = subMod(ans, mulMod(fat[n], lst));
  printf("%lld\n", ans);
  return 0;
}


#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  int n; cin >> n; ll a[n];
  rep(i, n) cin >> a[i];
  ll fac = 1;
  rep(i, n){
    fac*=(i+1); fac%=mod;
  }
  sort(a, a+n, greater<>());
  ll ans = 0; int cnt = 1;
  rep(i, n){
    if(a[i]==a[0]) continue;
    if(i<n-1 && a[i]==a[i+1]) cnt++;
    else{
      ans+=cnt*a[i]%mod*fac%mod*modinv(i+1, mod)%mod; ans%=mod; cnt = 1;
    }
  }
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "mydebug.h"
#else
#define debug(...)
#endif
typedef long long ll;typedef unsigned long long ul; typedef vector<ll> vl;

ll llp(ll x) {
  return x%1'000'000'007;
}

int main() {
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll N;
  cin >> N;

  map<ll, ll> A;
  for(int i=0;i<N;++i) {
    ll x;
    cin >> x;
    A[x]++;
  }

  vl RF(N+2, 1);
  RF[N+1]=1;
  for(ll i=N+1;i-->0;) {
    RF[i]=(RF[i+1]*i)%1'000'000'007;
  }
  vl F(N+2, 1);
  for(ll i=2;i<=N+1;i++)
    F[i]=(F[i-1]*i)%1'000'000'007;

  debug(RF);

  ll out=0;
  ll l=0;
  for(auto it=A.rbegin();it!=A.rend();++it) {
    auto [x, ct] = *it;
    if(l) {
      ll below = F[l+ct-1];
      ll above = RF[1+ct+l];
      out=llp(out+llp(llp(above*x)*llp(ct*below)));
    }
    debug(x, l, ct, out);
    l+=ct;
  }

  cout << out << endl;
}


#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "mydebug.h"
#else
#define debug(...)
#endif
typedef long long ll;typedef unsigned long long ul; typedef vector<ll> vl;

int main() {
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll N;
  cin >> N;

  map<ll, ll> A;
  for(int i=0;i<N;++i) {
    ll x;
    cin >> x;
    A[x]++;
  }

  vl RF(N+2, 1);
  RF[N+1]=1;
  for(ll i=N+1;i-->0;) {
    RF[i]=(RF[i+1]*i)%1'000'000'007;
  }
  vl F(N+2, 1);
  for(ll i=2;i<=N+1;i++)
    F[i]=(F[i-1]*i)%1'000'000'007;

  debug(RF);

  ll out=0;
  ll l=0;
  for(auto it=A.rbegin();it!=A.rend();++it) {
    auto [x, ct] = *it;
    if(l) {
      ll below = F[l+ct-1];
      ll above = RF[1+ct+l];
      out=(out+above*x*ct*below)%1'000'000'007;
    }
    debug(x, l, ct, out);
    l+=ct;
  }

  cout << out << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+6;
const ll mod = 1e9+7;
int n;ll a[N];
ll up[N],inv[N],down[N];
void init(){
    inv[1]=down[0]=up[0]=1;
    for(int i=2;i<=1e6;i++){
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    }
    for(int i=1;i<=1e6;i++){
        up[i]=up[i-1]*i%mod;
        down[i]=down[i-1]*inv[i]%mod;
    }
}
int main(){
    //ios::sync_with_stdio(false);
    init();
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    ll ans=0;
    for(int i=1,j;i<=n;i=j+1){
        j=i;
        while (a[j+1]==a[i])j++;
        if(j<n)
        ans=(ans+a[i]*(j-i+1)%mod*up[n]%mod*up[n-i]%mod*up[i-1]%mod*down[n-i+1]%mod*down[i-1]%mod)%mod;
    }
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+6;
const ll mod = 1e9+7;
int n;ll a[N];
ll up[N],inv[N],down[N];
void init(){
    inv[1]=down[0]=up[0]=1;
    for(int i=2;i<=1e6;i++){
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    }
    for(int i=1;i<=1e6;i++){
        up[i]=up[i-1]*i%mod;
        down[i]=down[i-1]*inv[i]%mod;
    }
}
int main(){
    //ios::sync_with_stdio(false);
    init();
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    ll ans=0;
    for(int i=1,j;i<=n;i=j+1){
        j=i;
        while (a[j+1]==a[i])j++;
        if(j<n)
        ans=(ans+a[i]*(j-i+1)%mod*up[j-i+1]%mod*up[n]*up[n-j]%mod*up[n-j+i-2]%mod*down[n-i+1]%mod*down[i-1]%mod)%mod;
    }
    cout<<ans<<endl;
}


#include <bits/stdc++.h>

using namespace std;

const int MOD = 1E9 + 7;
const int MAXN = 1E6;
int a[MAXN];
int fac[MAXN + 1];
int invfac[MAXN + 1];

int modpow(int b, int e)
{
    int ans = 1;
    while (e)
    {
        if (e & 1)
            ans = (int) ((long long) ans * b % MOD);
        e >>= 1;
        b = (int) ((long long) b * b % MOD);
    }
    return ans;
}

int modinv(int x)
{
    return modpow(x, MOD - 2);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    fac[0] = invfac[0] = 1;
    for (int i = 1; i <= MAXN; i++)
    {
        fac[i] = (int) ((long long) fac[i - 1] * i % MOD);
        invfac[i] = modinv(fac[i]);
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int ans = 0;
    int p = 0;
    for (int i = 0; i < n && a[i] < a[n - 1]; i++)
    {
        while (a[p] < a[i])
            p++;
        int B = p;
        int A = n - 1 - B;
        int temp = (int) ((long long) fac[n] * modinv(A + 1) % MOD);
        temp = (int) ((long long) temp * a[i] % MOD);
        ans += temp;
        if (ans >= MOD)
            ans -= MOD;
    }
    cout << ans << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MOD = 1E9 + 7;
const int MAXN = 1E6;
int a[MAXN];
int fac[MAXN + 1];
int invfac[MAXN + 1];

int modpow(int b, int e)
{
    int ans = 1;
    while (e)
    {
        if (e & 1)
            ans = (int) ((long long) ans * b % MOD);
        e >>= 1;
        b = (int) ((long long) b * b % MOD);
    }
    return ans;
}

int modinv(int x)
{
    return modpow(x, MOD - 2);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    fac[0] = invfac[0] = 1;
    for (int i = 1; i <= MAXN; i++)
    {
        fac[i] = (int) ((long long) fac[i - 1] * i % MOD);
        invfac[i] = modinv(fac[i]);
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int ans = 0;
    int p = 0;
    for (int i = 0; i < n && a[i] < a[n - 1]; i++)
    {
        while (a[p] < a[i])
            p++;
        int B = p;
        int A = n - 1 - B;
        int temp = (int) ((long long) fac[n] * invfac[A + 1] % MOD);
        temp = (int) ((long long) temp * a[i] % MOD);
        if (B)
            ans += temp;
        else
            ans += fac[A];
        if (ans >= MOD)
            ans -= MOD;
    }
    cout << ans << "\n";
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
const ll mod=1e9+7;
ll n,a[1000008],b=1ll,s=0,pos;
ll gmod(ll a,ll b)
{
    ll res = 1;
    while(b>0)
    {
        if(b&1)  res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    FOR(i,1,n) sl(a[i]);
    for(ll i=2;i<=n;i++)  b=(b*i)%mod;
    sort(a+1,a+n+1);
    FOR(i,1,n)
    {
        if(a[i]==a[n])  break;
        pos=i;
        while(a[i]==a[pos])  pos++;
        pos--;
        s+=(pos-i+1ll)*(b*gmod(n-i+1,mod-2ll)%mod)*a[i]%mod;
        s%=mod;
        i=pos;
    }
    cout<<s<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%I64d",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define pb push_back
#define lc (d<<1)
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
const ll mod=1e9+7;
ll n,a[1000008],b[1000008],c[1000008],s=0;
int main()
{
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    FOR(i,1,n) sl(a[i]);
    b[1]=1ll;
    for(ll i=2;i<=n;i++)  b[i]=(b[i-1]*i)%mod;
    c[0]=1ll;
    for(ll i=1;i<=n;i++)  c[i]=(c[i-1]*2ll)%mod;
    sort(a+1,a+n+1);
    FOR(i,1,n)
    {
        if(a[n]>a[i])
        {
            s+=c[i-1]*b[n-i]%mod;
            s%=mod;
        }
        else break;
    }
    cout<<s<<endl;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <ctime>
#include <map>
#include <set>

using namespace std;

#define endl "\n"
#define X first
#define Y second
#define Z third
#define mp make_pair
#define mt make_triple

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.141592653589793;
const ld E = 2.71828182845904523;
const ll LLINF = 4000000009000000099;
const ll INF = 1009000099;
const ll MOD7 = 1000000007;
const ll MOD9 = 1000000009;

template<class A, class B, class C> struct triple { A first; B second; C third; triple(A, B, C); triple(); };
template<class A, class B, class C> triple<A, B, C>::triple(A a, B b, C c) { first = a; second = b; third = c; }
template<class A, class B, class C> triple<A, B, C>::triple() { }
template<class A, class B, class C> triple<A, B, C> make_triple(A a, B b, C c) { triple<A, B, C> t(a, b, c); return t; }
template<class A, class B, class C> bool operator<(triple<A, B, C> a, triple<A, B, C> b) { if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second < b.second; if (a.third != b.third) return a.third < b.third; }
template<class T> T inline sqr(T a) { return a * a; }

ll bpow(ll a, ll d, ll mod) { if (d == 0) return 1; ll t = bpow(a, d / 2, mod); t = (t * t) % mod; if (d & 1) t = (t * a) % mod; return t; }
ll bpow(ll a, ll d) { if (d == 0) return 1; ll t = bpow(a, d / 2); t = (t * t); if (d & 1) t = (t * a); return t; }
ll gcd(ll a, ll b) { while (a && b) if (a > b) a %= b; else b %= a; return a + b; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll C(ll n, ll k) { ll res = 1; for (int i = 1; i <= k; ++i) res = res * (n - k + i) / i; return res; }
ll C(ll n, ll k, ll mod) { ll u = 1, d = 1; for (int i = 2; i <= n; ++i) u = (u * i) % mod; int x = max(k, n - k), z = min(k, n - k); for (int i = 2; i <= x; ++i) { d = (d * i) % mod; if (i <= z) d = (d * i) % mod; } d = bpow(d, mod - 2, mod); ll res = (u * d) % mod; return res; }

void solve()
{
	int n; cin >> n;
	vector<ll> v(n);
	map<ll, ll> gr;
	for (int i = 0; i < n; ++i)
		cin >> v[i];

	sort(v.begin(), v.end());
	for (int i = n - 1; i >= 0; --i)
		gr[v[i]] = n - i - 1;

	vector<ll> f(n);
	f[0] = 1;
	for (int i = 1; i < n; ++i)
		f[i] = f[i - 1] * i % MOD7;

	vector<ll> d(n);
	for (int i = 0; i < n; ++i)
		d[i] = f[n - i - 1] * f[i] % MOD7;

	for (int i = n - 2; i >= 0; --i)
	{
		d[i] += d[i + 1];
		d[i] %= MOD7;
	}

	ll ans = 0;

	for (int i = 0; i < n; ++i)
	{
		if (v[i] != v.back())
		{
			ans += v[i] * d[gr[v[i]]] % MOD7;
			ans %= MOD7;
		}
	}
	cout << ans;
}

int main() {
	ios::sync_with_stdio(0);
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#else
#endif
	solve();
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <utility>
#include <ctime>
#include <map>
#include <set>

using namespace std;

#define endl "\n"
#define X first
#define Y second
#define Z third
#define mp make_pair
#define mt make_triple

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.141592653589793;
const ld E = 2.71828182845904523;
const ll LLINF = 4000000009000000099;
const ll INF = 1009000099;
const ll MOD7 = 1000000007;
const ll MOD9 = 1000000009;

template<class A, class B, class C> struct triple { A first; B second; C third; triple(A, B, C); triple(); };
template<class A, class B, class C> triple<A, B, C>::triple(A a, B b, C c) { first = a; second = b; third = c; }
template<class A, class B, class C> triple<A, B, C>::triple() { }
template<class A, class B, class C> triple<A, B, C> make_triple(A a, B b, C c) { triple<A, B, C> t(a, b, c); return t; }
template<class A, class B, class C> bool operator<(triple<A, B, C> a, triple<A, B, C> b) { if (a.first != b.first) return a.first < b.first; if (a.second != b.second) return a.second < b.second; if (a.third != b.third) return a.third < b.third; }
template<class T> T inline sqr(T a) { return a * a; }

ll bpow(ll a, ll d, ll mod) { if (d == 0) return 1; ll t = bpow(a, d / 2, mod); t = (t * t) % mod; if (d & 1) t = (t * a) % mod; return t; }
ll bpow(ll a, ll d) { if (d == 0) return 1; ll t = bpow(a, d / 2); t = (t * t); if (d & 1) t = (t * a); return t; }
ll gcd(ll a, ll b) { while (a && b) if (a > b) a %= b; else b %= a; return a + b; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll C(ll n, ll k) { ll res = 1; for (int i = 1; i <= k; ++i) res = res * (n - k + i) / i; return res; }
ll C(ll n, ll k, ll mod) { ll u = 1, d = 1; for (int i = 2; i <= n; ++i) u = (u * i) % mod; int x = max(k, n - k), z = min(k, n - k); for (int i = 2; i <= x; ++i) { d = (d * i) % mod; if (i <= z) d = (d * i) % mod; } d = bpow(d, mod - 2, mod); ll res = (u * d) % mod; return res; }

void solve()
{
	int n; cin >> n;
	vector<ll> v(n);
	map<ll, ll> gr;
	for (int i = 0; i < n; ++i)
		cin >> v[i];

	sort(v.begin(), v.end());
	for (int i = n - 1; i >= 0; --i)
		gr[v[i]] = n - i - 1;

	vector<ll> f(n + 1);
	f[0] = 1;
	for (int i = 1; i <= n; ++i)
		f[i] = f[i - 1] * i % MOD7;

	ll ans = 0;

	for (int i = 0; i < n; ++i)
	{
		if (v[i] != v.back())
		{
			ans += v[i] * f[n] % MOD7 * bpow(gr[v[i]] + 1, MOD7 - 2, MOD7);
			ans %= MOD7;
		}
	}
	cout << ans;
}

int main() {
	ios::sync_with_stdio(0);
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#else
#endif
	solve();
	return 0;
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>

#ifdef LOCAL
# include <opencv2/core/core.hpp>
# include <opencv2/highgui/highgui.hpp>
# include <opencv2/imgproc/imgproc.hpp>
#endif

using namespace std;

// Let's define unordered map
# ifdef __GNUC__
# if __cplusplus > 199711L
# include <unordered_set>
# include <unordered_map>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
using namespace tr1;
# endif
# else
# include <unordered_map>
# include <unordered_set>
# endif

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 6,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,_6,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,n) cerr<<#a<<"=["; printarray(a,n); cerr<<"]\n"
#define DAR(a,n,s) cerr<<#a<<"["<<s<<"-"<<n-1<<"]=["; printarray(a,n,s); cerr<<"]\n"

#ifdef _MSC_VER
#define PREFETCH(ptr, rw, level) ((void)0)
#else
#define PREFETCH(ptr, rw, level) __builtin_prefetch(ptr, rw, level)
#endif

#ifdef LOCAL
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#else
#define CURTIME()
#endif

#define mp make_pair
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef int itn;

template<class T1, class T2, class T3>
struct triple{ T1 a; T2 b; T3 c; triple() : a(T1()), b(T2()), c(T3()) {}; triple(T1 _a, T2 _b, T3 _c) :a(_a), b(_b), c(_c){} };
template<class T1, class T2, class T3>
bool operator<(const triple<T1,T2,T3>&t1,const triple<T1,T2,T3>&t2){if(t1.a!=t2.a)return t1.a<t2.a;else if(t1.b!=t2.b)return t1.b<t2.b;else return t1.c<t2.c;}
template<class T1, class T2, class T3>
bool operator>(const triple<T1,T2,T3>&t1,const triple<T1,T2,T3>&t2){if(t1.a!=t2.a)return t1.a>t2.a;else if(t1.b!=t2.b)return t1.b>t2.b;else return t1.c>t2.c;}
#define tri triple<int,int,int>
#define trll triple<ll,ll,ll>

#define FI(n) for(int i=0;i<(n);++i)
#define FJ(n) for(int j=0;j<(n);++j)
#define FK(n) for(int k=0;k<(n);++k)
#define FL(n) for(int l=0;l<(n);++l)
#define FQ(n) for(int q=0;q<(n);++q)
#define FOR(i,a,b) for(int i = (a), __e = (int) (b); i < __e; ++i)
#define all(a) std::begin(a), std::end(a)
#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())

#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(1.0 * (x))
#define pow(x, n) pow(1.0 * (x), n)

#define COMPARE(obj) [&](const std::decay_t<decltype(obj)>& a, const std::decay_t<decltype(obj)>& b)
#define COMPARE_BY(obj, field) [&](const std::decay_t<decltype(obj)>& a, const std::decay_t<decltype(obj)>& b) { return a.field < b.field; }

#define checkbit(n, b) (((n) >> (b)) & 1)
#define setbit(n, b) ((n) | (static_cast<std::decay<decltype(n)>::type>(1) << (b)))
#define removebit(n, b) ((n) & ~(static_cast<std::decay<decltype(n)>::type>(1) << (b)))
#define flipbit(n, b) ((n) ^ (static_cast<std::decay<decltype(n)>::type>(1) << (b)))
inline int countBits(uint v){v=v-((v>>1)&0x55555555);v=(v&0x33333333)+((v>>2)&0x33333333);return((v+(v>>4)&0xF0F0F0F)*0x1010101)>>24;}
inline int countBits(ull v){uint t=v>>32;uint p=(v & ((1ULL << 32) - 1)); return countBits(t) + countBits(p); }
inline int countBits(ll v){return countBits((ull)v); }
inline int countBits(int v){return countBits((uint)v); }
unsigned int reverseBits(uint x){ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
template<class T> inline int sign(T x){ return x > 0 ? 1 : x < 0 ? -1 : 0; }
inline bool isPowerOfTwo(int x){ return (x != 0 && (x&(x - 1)) == 0); }
constexpr ll power(ll x, int p) { return p == 0 ? 1 : (x * power(x, p - 1)); }
//template<class T1, class T2, class T3> T1 inline clamp(T1 x, const T2& a, const T3& b) { if (x < a) return a; else if (x > b) return b; else return x; }
unsigned long long rdtsc() { unsigned long long ret = 0;
#ifdef __clang__
    return __builtin_readcyclecounter();
#endif
#ifndef _MSC_VER
    asm volatile("rdtsc" : "=A" (ret) : :);
#endif
    return ret; }
// Fast IO ********************************************************************************************************
const int __BS = 4096;
static char __bur[__BS + 16], *__er = __bur + __BS, *__ir = __er;
template<class T = int> T readInt() {
    auto c = [&]() { if (__ir == __er) std::fill(__bur, __bur + __BS, 0), cin.read(__bur, __BS), __ir = __bur; };
    c(); while (*__ir && (*__ir < '0' || *__ir > '9') && *__ir != '-') ++__ir; c();
    bool m = false; if (*__ir == '-') ++__ir, c(), m = true;
    T r = 0; while (*__ir >= '0' && *__ir <= '9') r = r * 10 + *__ir - '0', ++__ir, c();
    ++__ir; return m ? -r : r;
}
static char __buw[__BS + 20], *__iw = __buw, *__ew = __buw + __BS;
template<class T>
void writeInt(T x, char endc = '\n') {
    if (x < 0) *__iw++ = '-', x = -x; if (x == 0) *__iw++ = '0';
    char* s = __iw;
    while (x) { T t = x / 10; char c = x - 10 * t + '0'; *__iw++ = c; x = t; }
    char* f = __iw - 1; while (s < f) swap(*s, *f), ++s, --f;
    if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw;
    *__iw++ = endc;
}
template<class T>
void writeStr(const T& str) {
    int i = 0; while (str[i]) { *__iw++ = str[i++]; if (__iw > __ew) cout.write(__buw, __iw - __buw), __iw = __buw; }
}
struct __FL__ { ~__FL__() { if (__iw != __buw) cout.write(__buw, __iw - __buw); } };
static __FL__ __flushVar__;

//STL output *****************************************************************************************************
#define TT1 template<class T>
#define TT1T2 template<class T1, class T2>
#define TT1T2T3 template<class T1, class T2, class T3>
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p);
TT1 ostream& operator << (ostream& os, const vector<T>& v);
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v);
TT1T2 ostream& operator << (ostream& os, const multiset<T1, T2>&v);
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v);
TT1T2T3 ostream& operator << (ostream& os, const map<T1, T2, T3>& v);
TT1T2T3 ostream& operator << (ostream& os, const multimap<T1, T2, T3>& v);
TT1T2T3 ostream& operator << (ostream& os, const triple<T1, T2, T3>& t);
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v);
TT1T2 ostream& operator << (ostream& os, const pair<T1, T2>& p){ return os <<"("<<p.first<<", "<< p.second<<")"; }
TT1 ostream& operator << (ostream& os, const vector<T>& v){       bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
template<class T, size_t N> ostream& operator << (ostream& os, const array<T, N>& v) {     bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const set<T1, T2>&v){    bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multiset<T1,T2>&v){bool f=1;os<<"[";for(auto& i : v) { if (!f)os << ", ";os<<i;f=0;}return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const map<T1,T2,T3>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, const multimap<T1, T2>& v){ bool f = 1; os << "["; for (auto& ii : v) { if (!f)os << ", "; os << "(" << ii.first << " -> " << ii.second << ") "; f = 0; }return os << "]"; }
TT1T2 ostream& operator << (ostream& os, priority_queue<T1, T2> v) { bool f = 1; os << "["; while (!v.empty()) { auto x = v.top(); v.pop(); if (!f) os << ", "; f = 0; os << x; } return os << "]"; }
TT1T2T3 ostream& operator << (ostream& os, const triple<T1, T2, T3>& t){ return os << "(" << t.a << ", " << t.b << ", " << t.c << ")"; }
TT1T2 void printarray(const T1& a, T2 sz, T2 beg = 0){ for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }

//STL input *****************************************************************************************************
TT1T2T3 inline istream& operator >> (istream& os, triple<T1, T2, T3>& t);
TT1T2 inline istream& operator >> (istream& os, pair<T1, T2>& p) { return os >> p.first >> p.second; }
TT1 inline istream& operator >> (istream& os, vector<T>& v) {
    if (v.size()) for (T& t : v) os >> t; else {
        string s; T obj; while (s.empty()) {getline(os, s); if (!os) return os;}
        stringstream ss(s); while (ss >> obj) v.push_back(obj);
    }
    return os;
}
TT1T2T3 inline istream& operator >> (istream& os, triple<T1, T2, T3>& t) { return os >> t.a >> t.b >> t.c; }

//Pair magic *****************************************************************************************************
#define PT1T2 pair<T1, T2>
TT1T2 inline PT1T2 operator+(const PT1T2 &p1 , const PT1T2 &p2) { return PT1T2(p1.first + p2.first, p1.second + p2.second); }
TT1T2 inline PT1T2& operator+=(PT1T2 &p1 , const PT1T2 &p2) { p1.first += p2.first, p1.second += p2.second; return p1; }
TT1T2 inline PT1T2 operator-(const PT1T2 &p1 , const PT1T2 &p2) { return PT1T2(p1.first - p2.first, p1.second - p2.second); }
TT1T2 inline PT1T2& operator-=(PT1T2 &p1 , const PT1T2 &p2) { p1.first -= p2.first, p1.second -= p2.second; return p1; }

#undef TT1
#undef TT1T2
#undef TT1T2T3

#define FREIN(FILE) freopen(FILE, "rt", stdin)
#define FREOUT(FILE) freopen(FILE, "wt", stdout)
#ifdef LOCAL
#define BEGIN_PROFILE(idx, name) int profileIdx = idx; profileName[profileIdx] = name; totalTime[profileIdx] -= rdtsc() / 1e3;
#define END_PROFILE totalTime[profileIdx] += rdtsc() / 1e3; totalCount[profileIdx]++;
#else
#define BEGIN_PROFILE(idx, name)
#define END_PROFILE
#endif

template<class T> inline void normmod(T &x, T m) { x %= m; if (x < 0) x += m; }
template<class T1, class T2> inline T2 summodfast(T1 x, T1 y, T2 m) { T2 res = x + y; if (res >= m) res -= m; return res; }
template<class T1, class T2, class T3> inline void addmodfast(T1 &x, T2 y, T3 m) { x += y; if (x >= m) x -= m; }
template<class T1, class T2, class T3> inline void submodfast(T1 &x, T2 y, T3 m) { x -= y; if (x < 0) x += m; }
#if INTPTR_MAX == INT32_MAX or !defined(__SIZEOF_INT128__)
inline ll mulmod(ll x, ll n, ll m){ ll r = 0; normmod(x, m); normmod(n, m); while (n) { if (n & 1) r += x; x += x; if (r >= m) r -= m; if (x >= m) x -= m; n /= 2; } return r; }
#else
using int128 = __int128;
inline ll mulmod(ll x, ll n, ll m){ return __int128(x) * n % m; }
#endif
inline ll powmod(ll x, ll n, ll m){ ll r = 1; normmod(x, m); while (n){ if (n & 1) r *= x; x *= x; r %= m; x %= m; n /= 2; }return r; }
inline ll powmulmod(ll x, ll n, ll m) { ll res = 1; normmod(x, m); while (n){ if (n & 1)res = mulmod(res, x, m); x = mulmod(x, x, m); n /= 2; } return res; }
template<class T> inline T gcd(T a, T b) { while (b) { T t = a % b; a = b; b = t; } return a; }
template<class T>
T fast_gcd(T u, T v) {
    int shl = 0; while ( u && v && u != v) { T eu = u & 1; u >>= eu ^ 1; T ev = v & 1; v >>= ev ^ 1;
        shl += (~(eu | ev) & 1); T d = u & v & 1 ? (u + v) >> 1 : 0; T dif = (u - v) >> (sizeof(T) * 8 - 1); u -= d & ~dif; v -= d & dif;
    } return std::max(u, v) << shl;
}

inline ll lcm(ll a, ll b){ return a / gcd(a, b) * b; }
template<class T> inline T gcd(T a, T b, T c){ return gcd(gcd(a, b), c); }
ll gcdex(ll a, ll b, ll& x, ll& y) {
    if (!a) { x = 0; y = 1; return b; }
    ll y1; ll d = gcdex(b % a, a, y, y1); x = y1 - (b / a) * y;
    return d;
}
template<class T> bool isPrime(T x) { if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
    for (T i = 5; i * i <= x; i += 6) if (x % i == 0 || x % (i + 2) == 0) return 0; return 1; }
bool millerRabin(long long n) {
    if (n <= 1000) return isPrime(n);
    long long s = n - 1; int t = 0; while (s % 2 == 0) s /= 2, ++t;
    for (int a : {2, 325, 9375, 28178, 450775, 9780504, 1795265022}) { if (!(a %= n)) return true;
        long long f = powmulmod(a, s, n); if (f == 1 || f == n - 1) continue;
        for (int i = 1; i < t; ++i) if ((f = mulmod(f, f, n)) == n - 1) goto nextp;
        return false; nextp:;
    } return true;
}

// Useful constants

//int some_primes[7] = {24443, 100271, 1000003, 1000333, 5000321, 98765431, 1000000123};
#define T9          1000000000
#define T18         1000000000000000000LL
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define mod         1000000007
#define fftmod      998244353
#define EPS         (double)1e-10
#define PI          3.14159265358979323846264
#define link        asaxlajrewqwe
#define rank        wahayawehasdakw
//*************************************************************************************

int32_t solve();
int32_t main(int argc, char** argv) {
    ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef LOCAL
    //        FREIN("input.txt");
    //        FREOUT("out.txt");
#endif
    return solve();
}

int a[1010101];
int solve() {
    int n;
    cin >> n;
    ll f = 1;
    for (int i = 1; i <= n; ++i) {
        f = f * i % mod;
    }
    FI(n) {
        cin >> a[i];
    }
    sort(a, a + n);
    int bgo = n - 1;
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == a[n - 1]) break;
        if (i && a[i] != a[i - 1]) {
            bgo = n - 1 - i;
        }
        ll t = powmod(bgo + 1, mod - 2, mod);
        ans = (ans + t * a[i]) % mod;
    }
    cout << ans * f % mod << endl;

//    {
//        int ids[10];
//        FI(n) {
//            ids[i] = i;
//        }
//        ll res = 0;
//        do {
//            int m = a[ids[0]];
//            FI(n) {
//                int x = a[ids[i]];
//                if (x > m) {
//                    res += m;
//                    m = x;
//                }
//            }
//        } while (next_permutation(ids, ids + n));
//        cout << res << endl;
//    }

    return 0;
}