#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using lld = long double;
const ll oo = 0x3f3f3f3f;
const ll MOD = 1000000007;
ll h[200000];
ll pre[200000];
ll a, r, n, m;
ll get_cost(ll i) {
  ll large = 0, small = 0;
  small = h[i] * (i + 1) - pre[i];
  large = pre[n - 1] - (i ? pre[i - 1] : 0) - h[i] * (n - i);
  ll mi = min(large, small);
  return mi * m + (large - mi) * r + (small - mi) * a;
}
ll get_cost2(ll to) {
  ll large = 0, small = 0;
  for (ll i = 0; i < n; i++)
    if (h[i] > to)
      large += (h[i] - to);
    else
      small += (to - h[i]);
  ll t = min(small, large) == small ? (large - small) * r : (small - large) * a;
  return t + min(small, large) * m;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> r >> m;
  for (ll i = 0; i < n; i++) cin >> h[i];
  sort(h, h + n);
  m = min(a + r, m);
  for (ll i = 0; i < n; i++) pre[i] = h[i] + (i ? pre[i - 1] : 0);
  ll mean = (pre[n - 1]) / n;
  ll ans = min(get_cost2(mean), get_cost2(mean + 1));
  for (ll i = 0; i < n; i++) ans = min(ans, get_cost(i));
  cout << ans << '\n';
  return 0;
}
