#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a);
    }
    a = (a * a);
    b >>= 1;
  }
  return ans;
}
vector<long long> h, pre;
long long a, r, m, n;
long long solve(long long H) {
  m = min(m, a + r);
  long long pos = lower_bound(h.begin(), h.end(), H) - h.begin();
  long long res = 0;
  long long add = H * pos - pre[pos];
  long long rem = pre[n] - pre[pos] - H * (n - pos);
  res = min(add, rem);
  add -= res;
  rem -= res;
  res *= m;
  res += (add * a);
  res += (rem * r);
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> r >> m;
  long long val, sum = 0, ans = 1e18;
  for (long long i = 0; i < n; i++) {
    cin >> val;
    h.push_back(val);
    sum += val;
  }
  sort(h.begin(), h.end());
  pre.push_back(0);
  for (long long i = 0; i < n; i++) {
    pre.push_back(pre[i] + h[i]);
  }
  ans = min(ans, solve(sum / n));
  ans = min(ans, solve(sum / n + 1));
  for (long long i = 0; i < n; i++) {
    ans = min(ans, solve(h[i]));
  }
  cout << ans << endl;
}
