#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 100010;
long long n, a, r, m;
long long h[maxn];
long long f(long long x) {
  long long ans = 0;
  long long am = 0, rm = 0, mm = 0, nm = 0;
  for (long long i = 1; i <= n; i++) {
    if (h[i] > x) rm += h[i] - x;
    if (h[i] < x) am += x - h[i];
  }
  if (a + r <= m) {
    ans = am * a + rm * r;
  } else {
    mm = min(am, rm);
    if (am > rm) nm = (am - rm) * a;
    if (am < rm) nm = (rm - am) * r;
    ans = mm * m + nm;
  }
  return ans;
}
long long tri(long long x1, long long x2) {
  long long l = x1, r = x2;
  long long x = 1e18;
  while (l <= r) {
    long long margin = (r - l) / 3;
    long long a = l + margin;
    long long b = r - margin;
    x = min(min(f(a), f(b)), x);
    if (f(a) > f(b))
      l = a + 1;
    else
      r = b - 1;
  }
  return x;
}
int main() {
  std::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);
  long long out = tri(h[1], h[n]);
  cout << out << endl;
  return 0;
}
