#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n, a, r, m, h[N], f[N];
long long solve(long long x) {
  long long le = 1, ri = n;
  while (le <= ri) {
    long long mid = (le + ri) / 2;
    if (h[mid] <= x)
      le = mid + 1;
    else
      ri = mid - 1;
  }
  long long add = f[ri];
  long long del = f[n] - f[ri];
  long long amount_add = x * ri - add;
  long long amount_del = del - x * (n - ri);
  if (a + r <= m) {
    return amount_add * a + amount_del * r;
  } else {
    if (amount_add < amount_del) {
      return m * amount_add + (amount_del - amount_add) * r;
    } else {
      return m * amount_del + (amount_add - amount_del) * a;
    }
  }
  return (long long)1e18;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> r >> m;
  for (long long i = 1; i <= n; i++) cin >> h[i];
  sort(h + 1, h + n + 1);
  for (long long i = 1; i <= n; i++) f[i] = f[i - 1] + h[i];
  long long l = 1, r = 1e9;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (solve(mid) > solve(mid + 1))
      l = mid + 1;
    else
      r = mid - 1;
  }
  cout << solve(l);
  return 0;
}
