#include <bits/stdc++.h>
using namespace std;
long long a, r, m;
int n;
long long v[10000000];
long long cnt(long long x) {
  long long b = 0, e = 0;
  for (int i = 0; i < n; ++i) {
    if (v[i] < x)
      b += x - v[i];
    else
      e += v[i] - x;
  }
  long long ot = 0;
  ot += min((a + r) * min(e, b), m * min(e, b));
  if (e >= b) {
    e -= b;
    b -= b;
  }
  if (b >= e) {
    b -= e;
    e -= e;
  }
  ot += a * b;
  ot += r * e;
  if (ot < 0) ot = 1e18 + 7;
  return ot;
}
int main() {
  cin >> n >> a >> r >> m;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long long ans = 1e18 + 7;
  int l = 0, r = 1e9;
  while (l <= r) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    long long ot1 = cnt(m1);
    long long ot2 = cnt(m2);
    ans = min(ans, min(ot1, ot2));
    if (ot1 < ot2) {
      r = m2 - 1;
    } else {
      l = m1 + 1;
    }
  }
  cout << ans << endl;
}
