#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#define pb push_back
#define bg begin
#define ed end
#define ins insert
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
ll p[300005], sums[300005];
int main ()
{
ll n;
scanf ("%lld", &n);
for (int i = 0; i < n; ++i)
{
scanf ("%lld", &p[i]);
}
sort (p, p + n);
for (int i = 0; i < n; ++i)
{
if (!i)
sums[i] = p[i];
else
sums[i] += p[i] + sums[i-1];
}
ll ans = 2LL*sums[n-1]; ll q = 0;
for (ll q = 0; q < n-2; ++q)
{
ans += (sums[n-1]- p[q]);
}
printf ("%lld\n", ans);
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxjbWF0aD4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8bWFwPgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIGJnIGJlZ2luCiNkZWZpbmUgZWQgZW5kIAojZGVmaW5lIGlucyBpbnNlcnQKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnR5cGVkZWYgbG9uZyBsb25nIGxsOwp0eXBlZGVmIHZlY3RvcjxpbnQ+IHZpOwp0eXBlZGVmIHZlY3Rvcjx2aT4gdmlpOwoKbGwgcFszMDAwMDVdLCBzdW1zWzMwMDAwNV07CgppbnQgbWFpbiAoKQp7CglsbCBuOwoJc2NhbmYgKCIlbGxkIiwgJm4pOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCgl7CgkJc2NhbmYgKCIlbGxkIiwgJnBbaV0pOwoJfQkJCQoJc29ydCAocCwgcCArIG4pOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpCgl7CgkJaWYgKCFpKQoJCQlz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