#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n, add, rem, mov, sum = 0;
long long a[N];
long long calc(long long x) {
  long long need = 0, extra = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] < x)
      need += x - a[i];
    else
      extra += a[i] - x;
  }
  long long take = min(need, extra);
  long long cost = take * mov;
  need -= take, extra -= take;
  cost += need * add;
  cost += extra * rem;
  return cost;
}
long long ternary_search(long long lo, long long hi) {
  while (lo < hi - 2) {
    long long m1 = (lo * 2 + hi) / 3;
    long long m2 = (lo + hi * 2) / 3;
    if (calc(m1) < calc(m2))
      hi = m2;
    else
      lo = m1;
  }
  long long ans = calc(lo);
  for (long long i = lo + 1; i <= hi; i++) ans = min(ans, calc(i));
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> add >> rem >> mov;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  mov = min(mov, add + rem);
  long long ans = ternary_search(0, 1e9);
  cout << ans;
  return 0;
}
