#include <bits/stdc++.h>
using namespace std;
long long n;
long long a, r, md;
vector<long long> v;
long long TernarySearch(long long m) {
  long long sum1 = 0;
  for (auto x : v) {
    if (x <= m)
      sum1 += (m - x) * a;
    else if (x > m)
      sum1 += (x - m) * r;
  }
  long long sum2 = 0;
  long long smaller = 0;
  long long bigger = 0;
  for (auto x : v) {
    if (x < m)
      smaller += m - x;
    else if (x > m)
      bigger += x - m;
  }
  sum2 += min(smaller, bigger) * md;
  long long dif = smaller - bigger;
  if (dif < 0)
    sum2 += abs(dif) * r;
  else
    sum2 += dif * a;
  return (sum1 < sum2) ? sum1 : sum2;
}
int main() {
  cin >> n;
  cin >> a >> r >> md;
  for (int i = 0; i < n; i++) {
    long long b;
    cin >> b;
    v.push_back(b);
  }
  sort(v.begin(), v.end());
  long long s = v[0];
  long long e = v[v.size() - 1] + 1;
  while (e >= s) {
    long long m1;
    long long m2;
    m1 = s + (e - s) / 3;
    m2 = e - (e - s) / 3;
    long long f1 = TernarySearch(m1);
    long long f2 = TernarySearch(m2);
    if (e == s) {
      cout << TernarySearch(s);
      return 0;
    } else if (e == s + 1) {
      cout << min(TernarySearch(s), TernarySearch(e));
      return 0;
    } else if (e == s + 2) {
      cout << min(min(TernarySearch(s), TernarySearch(s + 1)),
                  TernarySearch(e));
      return 0;
    }
    if (f1 > f2) {
      s = m1;
    } else
      e = m2;
  }
  return 0;
}
