#include <bits/stdc++.h>
using namespace std;
long long int findCost(int arr[], int n, int a, int r, int m, int k) {
  long long int extra = 0, cost = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] >= k) {
      extra += (arr[i] - k);
    } else {
      long long int diff = k - arr[i];
      long long int toUse = min(diff, extra);
      long long int op1 = diff * a + toUse * r;
      long long int op2 = toUse * m + max(0LL, diff - toUse) * a;
      if (op1 < op2) {
        cost += op1;
      } else {
        cost += op2;
      }
      extra -= toUse;
    }
  }
  cost += extra * r;
  return cost;
}
long long int restorerDistance(int arr[], int n, int a, int r, int m) {
  sort(arr, arr + n, greater<int>());
  long long int start = 0, end = INT_MAX, ans = 1e18;
  while (start <= end) {
    long long int midLeft = start + (end - start) / 3,
                  midRight = end - (end - start) / 3;
    long long int costLeft = findCost(arr, n, a, r, m, midLeft),
                  costRight = findCost(arr, n, a, r, m, midRight);
    ans = min(ans, min(costLeft, costRight));
    if (costLeft < costRight)
      end = midRight - 1;
    else
      start = midLeft + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a, r, m;
  cin >> n >> a >> r >> m;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long int ans = restorerDistance(arr, n, a, r, m);
  cout << ans;
  return 0;
}
