#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, a, r, m;
  cin >> n >> a >> r >> m;
  vector<long long> h(n);
  for (long long i = 0; i < n; i++) {
    cin >> h[i];
  }
  auto f = [&](long long x) -> long long {
    long long cnt1 = 0;
    long long cnt2 = 0;
    for (long long i = 0; i < n; i++) {
      if (h[i] > x) {
        cnt2 += h[i] - x;
      } else {
        cnt1 += x - h[i];
      }
    }
    long long cur = 0;
    cur += min(cnt1, cnt2) * min(a + r, m);
    long long y = min(cnt1, cnt2);
    cnt1 -= y;
    cnt2 -= y;
    cur += cnt1 * a;
    cur += cnt2 * r;
    return cur;
  };
  long long l = 0, rr = 1e9 + 7;
  while (rr - l > 5) {
    long long m1 = l + (rr - l) / 3;
    long long m2 = rr - (rr - l) / 3;
    if (f(m1) < f(m2)) {
      rr = m2;
    } else {
      l = m1;
    }
  }
  long long ans = LLONG_MAX;
  for (long long i = l; i <= rr; i++) {
    ans = min(ans, f(i));
  }
  cout << ans << '\n';
  return 0;
}
