#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long first, unsigned long long second,
                unsigned long long m) {
  if (second == 0) return 1;
  long long p = power(first, second / 2, m) % m;
  p = (p * p) % m;
  return (second % 2 == 0) ? p : (first * p) % m;
}
long long modInverse(long long a, long long m) {
  long long g = gcd(a, m);
  { return power(a, m - 2, m); }
}
long long n, a, r, m;
long long arr[100005];
long long pre[100004];
long long doo(long long i, long long h = -1) {
  if (h == -1) h = arr[i];
  long long ans = 0;
  long long p, q;
  p = h * (i)-pre[i];
  q = pre[n] - pre[i] - (n - i) * h;
  long long sub = min(a + r, m);
  if (p >= q) {
    return sub * q + (p - q) * a;
  } else {
    return sub * (p) + (q - p) * r;
  }
}
void solve() {
  cin >> n >> a >> r >> m;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  sort(arr + 1, arr + n + 1);
  for (long long i = 1; i <= n; i++) pre[i] = pre[i - 1] + arr[i];
  long long ans = 2000000000000000005;
  for (long long i = 1; i <= n; i++) {
    ans = min(doo(i), ans);
  }
  long long hh = pre[n] / n;
  long long first = 0, second = 0;
  for (long long i = 1; i <= n; i++) {
    if (hh >= arr[i]) first = i;
    if (hh >= arr[i] - 1) second = i;
  }
  ans = min(ans, doo(first, hh));
  ans = min(ans, doo(second, hh + 1));
  cout << ans << endl;
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
