#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
constexpr double EPS = 1e-8;
int N, M, K, H, W, L, R;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  vector<long double> v(N);
  for (auto &i : v) cin >> i;
  sort(v.begin(), v.end());
  while (v.size() > 1) {
    v[0] += v[1];
    swap(v[1], v.back());
    v.pop_back();
    sort(v.begin(), v.end());
  }
  cout << setprecision(20) << v[0] << endl;
}
