#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T>
inline bool setmin(T &a, T b) {
  if (a > b) return a = b, 1;
  return 0;
}
template <class T>
inline bool setmax(T &a, T b) {
  if (a < b) return a = b, 1;
  return 0;
}
template <class T>
inline T fast(T a, T b, T mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
template <class T>
istream &operator>>(istream &os, vector<T> &container) {
  for (auto &u : container) os >> u;
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &container) {
  for (auto &u : container) os << u << " ";
  return os;
}
template <class T>
inline T gcd(T a, T b) {
  while (b) swap(a %= b, b);
  return a;
}
const long long INF = 1e9 + 7;
const long long mod = 998244353;
const long long BIG_INF = 1e18 + 7;
const long long N = 1e6 + 7;
const long long T = 1 << 20;
const long double inf = 1e18;
long long n, m, k, q;
long long a, r;
vector<long long> tab;
long long policz(long long wys) {
  long long suma = 0;
  long long ile_nad = 0;
  long long ile_pod = 0;
  for (auto &u : tab) {
    suma += u;
    ile_nad += max(0LL, u - wys);
    ile_pod += max(0LL, wys - u);
  }
  long long koniec = n * wys;
  long long ans = 0;
  long long pom = abs(koniec - suma);
  if (suma < koniec) {
    ans += a * pom;
    ans += m * (ile_pod - pom);
  } else {
    ans += r * pom;
    ans += m * (ile_nad - pom);
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> r >> m;
  m = min(m, a + r);
  tab.resize(n);
  cin >> tab;
  long long L = 0;
  long long R = INF;
  while (R - L > 5) {
    int third = (R - L) / 3;
    int A = L + third;
    int B = R - third;
    long long wyn_A = policz(A);
    long long wyn_B = policz(B);
    if (wyn_A < wyn_B)
      R = B;
    else
      L = A + 1;
  }
  long long ans = BIG_INF;
  for (int i = L; i < R; i++) {
    ans = min(ans, policz(i));
  }
  cout << ans << '\n';
}
