#include <bits/stdc++.h>
using namespace std;
long long n, a, r, m, h[100005], sum[100005], ans = 1e18;
bool check(long long val) {
  long long res = 0, po = 0, ne = 0;
  for (int i = 1; i <= n; i++) {
    if (h[i] > val) {
      po += h[i] - val;
    } else
      ne += val - h[i];
  }
  if (m < a + r) {
    long long temp = min(po, ne);
    res += m * temp;
    po -= temp;
    ne -= temp;
  }
  res += po * r + ne * a;
}
int main() {
  cin >> n >> a >> r >> m;
  for (int i = 1; i <= n; i++) cin >> h[i];
  sort(h + 1, h + n + 1);
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + h[i];
  if (1) {
    long long x = sum[n] / n;
    long long res = 0, po = 0, ne = 0;
    for (int i = 1; i <= n; i++) {
      if (h[i] > x) {
        po += h[i] - x;
      } else
        ne += x - h[i];
    }
    if (m < a + r) {
      long long temp = min(po, ne);
      res += m * temp;
      po -= temp;
      ne -= temp;
    }
    res += po * r + ne * a;
    ans = min(ans, res);
  }
  if (1) {
    long long x = ceil(1.0 * sum[n] / n);
    long long res = 0, po = 0, ne = 0;
    for (int i = 1; i <= n; i++) {
      if (h[i] > x) {
        po += h[i] - x;
      } else
        ne += x - h[i];
    }
    if (m < a + r) {
      long long temp = min(po, ne);
      res += m * temp;
      po -= temp;
      ne -= temp;
    }
    res += po * r + ne * a;
    ans = min(ans, res);
  }
  for (int i = 1; i <= n; i++) {
    long long res = 0, po = 0, ne = 0;
    po = sum[n] - sum[i] - (n - i) * h[i];
    ne = (i - 1) * h[i] - sum[i - 1];
    if (m < a + r) {
      long long temp = min(po, ne);
      res += m * temp;
      po -= temp;
      ne -= temp;
    }
    res += po * r + ne * a;
    ans = min(ans, res);
  }
  cout << ans;
}
