#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;
const int MAXN = 100010;
int n;
long long a, r, m, h[MAXN];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> r >> m;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  m = min(m, a + r);
  sort(h, h + n, greater<long long>());
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum += h[i];
  }
  long long lbound = (sum + n - 1) / n;
  long long cur = (n * h[0] - sum) * a;
  long long ans = 1e18;
  long long run = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] < lbound) break;
    long long lo = lbound;
    if (i + 1 < n) {
      lo = max(lo, h[i + 1]);
    }
    ans = min(ans, cur + run);
    long long delta = (i + 1) * m - n * a;
    run += delta * (h[i] - lo);
  }
  ans = min(ans, cur + run);
  reverse(h, h + n);
  long long ubound = sum / n;
  cur = (sum - n * h[0]) * r;
  run = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] > ubound) break;
    long long hi = ubound;
    if (i + 1 < n) {
      hi = min(hi, h[i + 1]);
    }
    ans = min(ans, cur + run);
    long long delta = (i + 1) * m - n * r;
    run += delta * (hi - h[i]);
    ;
  }
  ans = min(ans, cur + run);
  cout << ans;
}
