#include <bits/stdc++.h>
using namespace std;
const int N = 2000001;
int n, a, r, m;
vector<int> hs;
vector<long long> sum;
vector<long long> rsum;
pair<long long, pair<long long, long long>> get_ds(int h) {
  int in = upper_bound(hs.begin(), hs.end(), h) - hs.begin();
  long long n1 = in;
  long long n2 = n - n1;
  long long f = 0, s = 0;
  if (in != 0) f = n1 * h - sum[in - 1];
  if (in != n) s = rsum[in] - n2 * h;
  long long as = max(f - s, 0ll);
  long long rs = max(s - f, 0ll);
  long long ms = min(s, f);
  return {ms, {as, rs}};
}
long long calc_cost(long long ms, long long as, long long rs) {
  return ms * m + as * a + rs * r;
}
long long calc_cost(int h) {
  if (h < 0) return 1e18;
  auto x = get_ds(h);
  return calc_cost(x.first, x.second.first, x.second.second);
}
int main() {
  cin >> n >> a >> r >> m;
  hs.resize(n);
  sum.resize(n);
  rsum.resize(n);
  m = min(m, a + r);
  for (auto& e : hs) scanf("%d", &e);
  sort(hs.begin(), hs.end());
  sum[0] = hs[0];
  rsum[n - 1] = hs[n - 1];
  for (int i = 1; i < n; i++) sum[i] = sum[i - 1] + hs[i];
  for (int i = n - 2; i >= 0; i--) rsum[i] = rsum[i + 1] + hs[i];
  int l0, f0;
  l0 = f0 = -1;
  long long ans = 1e18;
  for (int i = 0; i < n; i++) {
    auto x = get_ds(hs[i]);
    if (x.second.first == 0 && f0 == -1) f0 = i;
    if (x.second.second == 0) l0 = i;
    ans = min(ans, calc_cost(x.first, x.second.first, x.second.second));
  }
  long long ir = get_ds(0).second.second;
  long long ih = ir / n;
  ans = min(ans, calc_cost(ih - 2));
  ans = min(ans, calc_cost(ih - 1));
  ans = min(ans, calc_cost(ih));
  ans = min(ans, calc_cost(ih + 1));
  ans = min(ans, calc_cost(ih + 2));
  cout << ans;
  return 0;
}
