#include <bits/stdc++.h>
using namespace std;
long long modinverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m, t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long mod_pow(long long a, long long n, long long p) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n >>= 1;
  }
  return ans;
}
long long prime_mod_pow(long long a, long long n, long long p) {
  long long ans = 1;
  n %= p - 1;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n >>= 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long n, a, r, m;
const long long MAXN = (long long)(1e5 + 10);
long long ht[MAXN], pref[MAXN];
long long value(long long h) {
  long long low = 1, high = n, ind = 0;
  while (high >= low) {
    long long mid = low + (high - low) / 2;
    if (ht[mid] > h) {
      high = mid - 1;
    } else {
      ind = mid;
      low = mid + 1;
    }
  }
  long long val = 0;
  long long need = ind * h - pref[ind];
  long long remove = pref[n] - pref[ind] - (n - ind) * h;
  if (need > remove)
    val = remove * m + (need - remove) * a;
  else
    val = need * m + (remove - need) * r;
  return val;
}
void solve() {
  cin >> n >> a >> r >> m;
  m = min(m, a + r);
  long long maxh = -1e18, minh = 1e18;
  for (long long i = 1; i < n + 1; i++) {
    cin >> ht[i];
    minh = min(minh, ht[i]);
    maxh = max(maxh, ht[i]);
  }
  sort(ht + 1, ht + n + 1);
  for (long long i = 1; i < n + 1; i++) pref[i] = pref[i - 1] + ht[i];
  long long ans = 1e18;
  long long low = minh, high = maxh;
  while (high - low >= 3) {
    long long m1 = low + (high - low) / 3, m2 = high - (high - low) / 3;
    long long v1 = value(m1), v2 = value(m2);
    if (v1 > v2)
      low = m1;
    else if (v1 < v2)
      high = m2;
    else {
      low = m1;
      high = m2;
    }
  }
  for (long long i = low; i < high + 1; i++) ans = min(ans, value(i));
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  long long o = 1;
  while (t--) {
    solve();
    o++;
  }
}
