#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 9;
long long n, a, r, m, ar[N];
long long f(long long h) {
  long long x = 0, y = 0, z = 0;
  for (long long i = 0; i < n; i++) {
    if (ar[i] < h)
      x += h - ar[i];
    else
      y += ar[i] - h;
  }
  z = min(x, y);
  x -= z, y -= z;
  return x * a + y * r + z * m;
}
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> r >> m;
  m = min(m, a + r);
  for (long long i = 0; i < n; i++) cin >> ar[i];
  long long hi = 1e10, lo = 0;
  while (hi - lo > 4) {
    long long m1 = (hi + lo) / 2;
    long long m2 = (hi + lo) / 2 + 1;
    if (f(m1) > f(m2))
      lo = m1;
    else
      hi = m2;
  }
  long long ans = 1e18;
  for (long long i = lo; i <= hi; i++) ans = min(ans, f(i));
  cout << ans;
}
