console.log((args=>{
  const [[N],A] = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  A.sort((a,b)=>b-a);
  let c = A[0];
  for ( let i = 1; i*2 < N-1; i++ ) {
    c += 2 * A[i];
  }
  if ( N&1 ) c += A[(N-1)/2];
  return `${c}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));