#include <bits/stdc++.h>
using namespace std;
const long long N = 100010;
long long n, a, r, m, h[N], maxx;
long long check(long long x) {
  long long cnt_1 = 0, cnt_2 = 0;
  for (long long i = 1; i <= n; i++) {
    cnt_1 += h[i] > x ? h[i] - x : 0;
    cnt_2 += x > h[i] ? x - h[i] : 0;
  }
  if (cnt_1 > cnt_2)
    return (cnt_1 - cnt_2) * r + cnt_2 * m;
  else
    return (cnt_2 - cnt_1) * a + cnt_1 * m;
}
signed main() {
  scanf("%lld %lld %lld %lld", &n, &a, &r, &m);
  m = min(m, a + r);
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &h[i]), maxx = max(maxx, h[i]);
  long long l = 1, r = maxx, ans = 0;
  while (l <= r) {
    long long mid = (r - l) / 3, mid_l = l + mid, mid_r = r - mid;
    if (check(mid_l) <= check(mid_r))
      r = mid_r - 1, ans = mid_r;
    else
      l = mid_l + 1;
  }
  printf("%lld\n", check(ans));
  return 0;
}
