#include <bits/stdc++.h>
using namespace std;
long long mod = (1000000007LL);
inline long long Mod(long long a, long long b) { return (a % b); }
inline long long poww(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
void read(vector<long long> &w, long long n) {
  w.resize(n);
  for (long long i = 0; i < n; i++) cin >> w[i];
}
void print(vector<long long> &w) {
  for (long long i = 0; i < (long long)(w).size(); i++) {
    if (i == (long long)(w).size() - 1)
      cout << w[i] << "\n";
    else
      cout << w[i] << " ";
  }
}
long long prodmod(vector<long long> w);
long long summod(vector<long long> w);
long long n, m, q, k, v[300050], ans, pref[300050];
pair<long long, long long> w[300050];
string second;
long long A, R, M, tot = 0;
long long solve(long long x) {
  long long l = lower_bound(v, v + n, x) - v;
  long long sl = x * l - pref[l];
  long long sg = (pref[n] - pref[l]) - x * (n - l);
  long long cost1 = R * sg + A * sl;
  long long q = min(sg, sl);
  sg -= q;
  sl -= q;
  long long cost2 = q * M + sg * R + sl * A;
  return min(cost1, cost2);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> A >> R >> M;
  map<long long, long long> mapa;
  for (long long i = (0); i < (n); ++i) cin >> v[i], tot += v[i], mapa[v[i]]++;
  sort(v, v + n);
  for (long long i = (1); i < (n + 1); ++i) pref[i] = pref[i - 1] + v[i - 1];
  tot /= n;
  long long ans = (long long)(1e18);
  for (long long i = max(0LL, tot - 100); i <= tot + 100; i++)
    ans = min(ans, solve(i));
  for (long long i = (0); i < (n); ++i) ans = min(ans, solve(v[i]));
  cout << ans << "\n";
}
long long summod(vector<long long> w) {
  long long curr = 0;
  for (long long i = 0; i < (long long)(w).size(); i++) {
    curr = (curr + w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}
long long prodmod(vector<long long> w) {
  long long curr = 1;
  for (long long i = 0; i < (long long)(w).size(); i++) {
    if (w[i] >= mod) w[i] %= mod;
    curr = (curr * w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}
