#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
bool checkFile(char* file_name) {
  ifstream file;
  file.open(file_name);
  if (!file)
    return false;
  else
    return true;
}
long long sum(long long n, long long maxval) {
  if (n <= 0) return 0;
  if (maxval < n)
    return n * (n + 1) / 2 - (n - maxval) * (n - maxval + 1) / 2;
  else
    return n * (n + 1) / 2;
}
long long n, a, r, m;
vector<long long> v;
long long f(long long h) {
  long long kol1 = 0, kol2 = 0;
  for (long long i = 0; i < n; i++) {
    kol1 += max(0ll, v[i] - h);
    kol2 += max(0ll, h - v[i]);
  }
  if (kol1 > kol2)
    return m * (kol2) + r * (kol1 - kol2);
  else
    return m * (kol1) + a * (kol2 - kol1);
}
void solve() {
  cin >> n >> a >> r >> m;
  v.resize(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  m = min(m, a + r);
  long long l = 0, r = 1e9;
  while ((r - l) > 2) {
    long long c1 = (2 * l + r) / 3, c2 = (l + 2 * r) / 3;
    if (f(c1) > f(c2))
      l = c1;
    else
      r = c2;
  }
  cout << min(min(f(l), f(r)), f(l + 1));
}
signed main() {
  if (checkFile("in")) {
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  }
  long long t;
  t = 1;
  while (t--) solve();
}
