#include <bits/stdc++.h>
using namespace std;
int n, a, r, m;
int H[100001];
long long count(int h) {
  long long sub = 0, add = 0, res = 0;
  for (int i = 1; i <= n; i++) {
    if (H[i] < h)
      add += h - H[i];
    else
      sub += h - H[i];
  }
  if (m < a + r) {
    long long mi = min(abs(sub), add), dif = sub + add;
    res += mi * m;
    if (abs(sub) < add)
      res += abs(dif) * a;
    else
      res += abs(dif) * r;
  } else
    res = abs(sub) * r + add * a;
  return res;
}
int main() {
  scanf("%d%d%d%d", &n, &a, &r, &m);
  int l = 0, r = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &H[i]);
    r = max(H[i], r);
  }
  while (l < r) {
    int midl = l + (r - l) / 3;
    int midr = r - (r - l) / 3;
    if (count(midl) >= count(midr))
      l = midl + 1;
    else
      r = midr - 1;
  }
  printf("%I64d\n", count(l));
  return 0;
}
