#include <bits/stdc++.h>
using namespace std;
long long n, a, r, m;
long long first(vector<long long> &v, long long x) {
  long long cost = 0;
  long long add = 0, sub = 0;
  for (auto i : v) {
    if (i < x) add += x - i;
    if (i > x) sub += i - x;
  }
  if (a + r > m) {
    long long foo = min(add, sub);
    add -= foo;
    sub -= foo;
    cost += m * foo;
  }
  cost += a * add;
  cost += r * sub;
  return cost;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> r >> m;
  vector<long long> v(n);
  for (int i = (0), ThxMK = (n); i < ThxMK; ++i) cin >> v[i];
  long long l = 0, r = 1e9;
  while (r - l > 2) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    long long f1 = first(v, m1);
    long long f2 = first(v, m2);
    if (f1 <= f2)
      r = m2;
    else
      l = m1;
    ;
  }
  long long res = 1e18;
  for (int i = (l), ThxMK = (r + 1); i < ThxMK; ++i)
    res = min(res, first(v, i));
  cout << res << '\n';
  return 0;
}
