#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n;
	cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	sort(arr,arr+n,greater<ll>());
	ll i=1,ans=0;
	for(;i<=n/2;i++){
		if(i==1){
			ans+=arr[0];
		}
		else{
			ans=ans+2*arr[i-1];
		}
	}
	if(n%2) ans+=arr[i-1];
	cout<<ans;
	return 0;
}