#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 10;
long long h[N], n, a, r, m, ans = 1e18;
long long check(long long mid) {
  long long res = 0, sum1 = 0, sum2 = 0;
  if (a + r <= m) {
    for (long long i = 1; i <= n; i++)
      if (h[i] >= mid)
        res += (h[i] - mid) * r;
      else
        res += (mid - h[i]) * a;
    return res;
  }
  for (long long i = 1; i <= n; i++)
    if (h[i] >= mid)
      sum1 += h[i] - mid;
    else
      sum2 += mid - h[i];
  res += min(sum1, sum2) * m;
  if (sum1 > sum2)
    res += (sum1 - sum2) * r;
  else
    res += (sum2 - sum1) * a;
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> a >> r >> m;
  for (long long i = 1; i <= n; i++) cin >> h[i];
  long long L = 0, R = 1e9;
  while (R - L > 10) {
    long long midl = L + (R - L) / 3, midr = R - (R - L) / 3;
    if (check(midl) < check(midr))
      R = midr;
    else
      L = midl;
  }
  for (long long i = L; i <= R; i++) ans = min(ans, check(i));
  cout << ans << '\n';
  return 0;
}
