#include <bits/stdc++.h>
using namespace std;
void init() {
  cin.tie(0);
  cin.sync_with_stdio(0);
}
const int N = 1e5 + 9, M = 1e6 + 9, OO = 0x3f3f3f3f;
const long long llOO = 0x3f3f3f3f3f3f3f3f;
int main() {
  init();
  long long n, a, rm, m;
  cin >> n >> a >> rm >> m;
  long long h[n], mn = 1e9, mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
    mx = max(mx, h[i]);
    mn = min(mn, h[i]);
  }
  auto check = [&](int len) {
    long long inc = 0, dec = 0;
    for (int i = 0; i < n; i++) {
      inc += max(0ll, len - h[i]);
      dec += max(0ll, h[i] - len);
    }
    long long mn = min(inc, dec);
    inc -= mn, dec -= mn;
    long long cost = min(mn * m, mn * a + mn * rm);
    cost += inc * a + dec * rm;
    return cost;
  };
  int l = mn, r = mx;
  while (r - l > 2) {
    int third = (r - l) / 3;
    int lf = l + third, rg = r - third;
    if (check(lf) < check(rg))
      r = rg;
    else
      l = lf;
  }
  cout << min({check(l), check(l + 1), check(l + 2)});
}
