#include <bits/stdc++.h>
using namespace std;
long long int h[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, a, r, m, sum = 0, h1, h2;
  cin >> n >> a >> r >> m;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h, h + n);
  m = min(a + r, m);
  for (int i = 0; i < n; i++) {
    sum += h[i];
  }
  h1 = (sum / n);
  h2 = (sum / n) + 1;
  long long int cost = 1e18, p = sum, q = 0, q1, p1, p2 = 0, q2 = 0, p3 = 0,
                q3 = 0;
  for (int i = 0; i < n; i++) {
    p -= h[i];
    q1 = i * h[i] - q;
    p1 = p - (n - i - 1) * h[i];
    if (p1 >= q1) {
      cost = min(cost, q1 * m + (p1 - q1) * r);
    } else {
      cost = min(cost, p1 * m + (q1 - p1) * a);
    }
    q += h[i];
  }
  for (int i = 0; i < n; i++) {
    if (h[i] >= h1) {
      p2 += (h[i] - h1);
    } else {
      q2 += (h1 - h[i]);
    }
    if (h[i] >= h2) {
      p3 += (h[i] - h2);
    } else {
      q3 += (h2 - h[i]);
    }
  }
  if (p2 >= q2) {
    cost = min(cost, q2 * m + (p2 - q2) * r);
  } else {
    cost = min(cost, p2 * m + (q2 - p2) * a);
  }
  if (p3 >= q3) {
    cost = min(cost, q3 * m + (p3 - q3) * r);
  } else {
    cost = min(cost, p3 * m + (q3 - p3) * a);
  }
  cout << cost << "\n";
  ;
  return 0;
}
