#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 6;
const int M = 998244353;
const long long inf = 1e18;
long long arr[N], cnt[N];
long long n, a, r, m;
long long f1(long long add, long long rem) {
  long long x = min(add, rem);
  add -= x;
  rem -= x;
  long long ret = x * m;
  ret += add * a;
  ret += rem * r;
  return ret;
}
long long ga(long long val, long long idx) {
  long long ret = val * idx;
  ret -= cnt[idx];
  return ret;
}
long long gr(long long val, long long idx) {
  long long ret = cnt[n];
  ret -= cnt[idx];
  ret -= (n - idx) * val;
  return ret;
}
long long f(long long val, long long idx) {
  long long add = ga(val, idx);
  long long rem = gr(val, idx);
  long long ret = f1(add, rem);
  ret = min(ret, add * a + rem * r);
  return ret;
}
long long ts(long long l, long long r, long long idx) {
  long long ret = inf;
  while (r - l > 50) {
    long long mid1 = l + (r - l) / 3;
    long long mid2 = r - (r - l) / 3;
    long long add = ga(mid1, idx);
    long long rem = gr(mid1, idx);
    long long c1 = min(add, rem);
    add = ga(mid2, idx);
    rem = gr(mid2, idx);
    long long c2 = min(add, rem);
    if (c1 >= c2)
      r = mid2;
    else
      l = mid1;
  }
  for (int i = l; i <= r; i++) ret = min(ret, f(i, idx));
  return ret;
}
void solve() {
  cin >> n >> a >> r >> m;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  sort(arr + 1, arr + 1 + n);
  for (int i = 1; i <= n; i++) cnt[i] = cnt[i - 1] + arr[i];
  long long ans = inf;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, f(arr[i], i));
    if (i < n && arr[i] != arr[i + 1]) {
      ans = min(ans, f(arr[i + 1] - 1, i));
      ans = min(ans, ts(arr[i], arr[i + 1], i));
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
