#include <bits/stdc++.h>
using namespace std;
long long int n, m, ar[1000005], sum, t, mark[15], r, a;
long long int check(long long int x) {
  long long int y = 0, z = 0;
  for (long long int i = 1; i <= n; i++)
    if (ar[i] < x)
      y += x - ar[i];
    else
      z += ar[i] - x;
  long long int top = 0;
  if (m < a + r) {
    long long int mn = min(y, z);
    top += mn * m;
    y -= mn;
    z -= mn;
  }
  return top + y * a + z * r;
}
long long int bs() {
  long long int l = 0, r = 1e9;
  while (l < r) {
    if (l == r - 1) {
      if (check(l) < check(r))
        return l;
      else
        return r;
    }
    long long int mid = (l + r) / 2;
    if (check(mid) < check(mid + 1))
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> r >> m;
  for (long long int i = 1; i <= n; i++) cin >> ar[i];
  sort(ar + 1, ar + n + 1);
  long long int x = bs();
  cout << check(bs());
}
