#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 5;
const long long inf = 8e18;
long long n, a, r, m;
long long h[maxn], acc[maxn];
long long calc(long long x) {
  int i = lower_bound(h + 1, h + 1 + n, x) - h;
  long long L = x * (i - 1) - acc[i - 1];
  long long R = (acc[n] - acc[i - 1]) - x * (n - i + 1);
  long long lo = min(L, R);
  L -= lo;
  R -= lo;
  long long move = min(a + r, m);
  long long cur = lo * move + L * a + R * r;
  return cur;
}
long long brute() {
  long long ans = inf;
  for (int x = h[1]; x <= h[n]; x++) {
    long long cur = calc(x);
    ans = min(ans, cur);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> r >> m;
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
  }
  sort(h + 1, h + 1 + n);
  for (int i = 1; i <= n; i++) {
    acc[i] = h[i] + acc[i - 1];
  }
  long long lo = h[1] - 1;
  long long hi = h[n];
  while (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (calc(mid - 1) < calc(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  long long ans = min({calc(hi - 2), calc(hi - 1), calc(hi)});
  assert(ans < inf);
  out(ans);
  return 0;
}
