#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int h[N];
int n, a, r, m;
long long f(int x) {
  int pt1 = 0, pt2 = n - 1;
  long long ans = 0;
  int h2[n];
  for (int i = 0; i < n; i++) h2[i] = h[i];
  while (pt1 < pt2) {
    int dif_left = x - h2[pt1];
    int dif_right = h2[pt2] - x;
    if (dif_left <= 0) {
      for (int i = pt1; i <= pt2; i++) ans += (long long)r * (h2[i] - x);
      return ans;
    } else if (dif_right <= 0) {
      for (int i = pt1; i <= pt2; i++) ans += (long long)a * (x - h2[i]);
      return ans;
    }
    if (dif_left < dif_right) {
      h2[pt2] -= dif_left;
      ans += (long long)m * dif_left;
      pt1++;
    } else if (dif_left > dif_right) {
      h2[pt1] += dif_right;
      ans += (long long)m * dif_right;
      pt2--;
    } else {
      ans += (long long)m * dif_left;
      pt1++;
      pt2--;
    }
  }
  if (pt1 == pt2) {
    if (h2[pt1] < x)
      ans += (long long)a * (x - h2[pt1]);
    else
      ans += (long long)r * (h2[pt1] - x);
  }
  return ans;
}
int ternary_search(int l, int r) {
  if (l >= r) return l;
  int m = (l + r - 1) / 2;
  if (f(m) < f(m + 1))
    return ternary_search(l, m);
  else
    return ternary_search(m + 1, r);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> a >> r >> m;
  m = min(m, a + r);
  for (int i = 0; i < n; ++i) cin >> h[i];
  sort(h, h + n);
  cout << f(ternary_search(0, 1e9)) << "\n";
  return 0;
}
