#include <bits/stdc++.h>
using namespace std;
long long int cost(long long int h[], long long int n, long long int a,
                   long long int r, long long int m, long long int x) {
  long long int plus = 0, minus = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] > x) {
      minus += h[i] - x;
    } else if (h[i] < x) {
      plus += x - h[i];
    }
  }
  if (m > a + r) {
    return (a * plus + r * minus);
  } else {
    return (min(plus, minus) * m + (plus - min(plus, minus)) * a +
            (minus - min(plus, minus)) * r);
  }
}
int main() {
  long long int n, a, r, m;
  cin >> n >> a >> r >> m;
  long long int h[n], start = 0, end = 0;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
    end = max(end, h[i]);
  }
  long long int ans = 1e18;
  while (start <= end) {
    long long int mid = (start + end) >> 1, mid_1;
    long long int c_mid = cost(h, n, a, r, m, mid);
    if (c_mid < ans) {
      ans = c_mid;
    }
    mid_1 = mid + 1;
    long long int c_mid_1 = cost(h, n, a, r, m, mid_1);
    if (c_mid_1 > c_mid) {
      end = mid - 1;
    } else {
      start = mid + 1;
    }
  }
  cout << ans << "\n";
}
