#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
const long long MB = 31;
const long long MOD = 1e9 + 7;
void solve() {
  long long n, a, r, m;
  cin >> n >> a >> r >> m;
  m = min(m, a + r);
  vector<long long> h(n);
  for (long long i = 0; i < n; i++) cin >> h[i];
  sort(h.begin(), h.end());
  long long sum = 0;
  for (long long i : h) sum += i;
  long long one = 0, two = 0;
  long long x = sum / n + 1;
  long long id = 0, cnt = 0;
  for (long long i : h) {
    if (i > x) {
      cnt++;
      two += i - x;
    } else {
      one += x - i;
      id++;
    }
  }
  long long ans = INF;
  ans = min(ans, (one - two) * a + two * m);
  for (long long i = id; i < n; i++) {
    two -= cnt * (h[i] - x);
    one += (n - cnt) * (h[i] - x);
    cnt--;
    x = h[i];
    long long y = ans = min(ans, (one - two) * a + two * m);
  }
  x = sum / n;
  id = 0, cnt = 0;
  one = 0, two = 0;
  for (long long i : h) {
    if (i > x) {
      cnt++;
      two += i - x;
    } else {
      one += x - i;
      id++;
    }
  }
  ans = min(ans, (two - one) * r + one * m);
  for (long long i = id - 1; i >= 0; i--) {
    two += (x - h[i]) * cnt;
    one -= (x - h[i]) * (n - cnt);
    cnt++;
    x = h[i];
    long long y = sum - x * n;
    ans = min(ans, (two - one) * r + one * m);
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(12);
  cout << fixed;
  long long t = 1;
  while (t--) solve();
}
