#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 99;
long long n, A, R, M, m, sum, ans = 1e18, a[N];
void make_m() {
  int l = 0, r = 1e9 + 1, mid;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (1ll * mid * n < sum)
      l = mid;
    else
      r = mid;
  }
  m = r;
}
long long calcf(long long x) {
  long long res = 0;
  res = R * (sum - x * n);
  int l = -1, r = n, mid;
  while (l + 1 < r) {
    mid = (l + r) / 2;
    long long p = a[mid];
    if (mid > 0) p -= a[mid - 1];
    if (p <= x)
      l = mid;
    else
      r = mid;
  }
  if (l >= 0) res += (1ll * (l + 1ll) * x - a[l]) * M;
  return res;
}
void solvef() {
  int l = 0, r = m, mid;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (calcf(mid - 1) >= calcf(mid))
      l = mid;
    else
      r = mid;
  }
  ans = min(ans, calcf(l));
  ;
}
long long calcs(long long x) {
  long long res = 0;
  res = A * (x * n - sum);
  int l = 0, r = n, mid;
  while (l + 1 < r) {
    mid = (l + r) / 2;
    int p = a[mid] - a[mid - 1];
    if (p <= x)
      l = mid;
    else
      r = mid;
  }
  res += ((a[n - 1] - a[l]) - (n - r) * x) * M;
  return res;
}
void solves() {
  int l = m, r = 1e9 + 2, mid;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (calcs(mid - 1) >= calcs(mid))
      l = mid;
    else
      r = mid;
  }
  ans = min(ans, calcs(l));
  ;
}
int main() {
  cin >> n >> A >> R >> M;
  M = min(M, R + A);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  make_m();
  for (int i = 1; i < n; i++) a[i] += a[i - 1];
  solvef();
  solves();
  cout << ans;
}
