#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("sse,sse2,sse3,sse4")
long long n, a, r, m, sum = 0;
vector<long long> v;
long long cost(long long h) {
  long long add = 0;
  long long remove = 0;
  for (auto x : v) {
    if (x >= h)
      remove += x - h;
    else
      add += h - x;
  }
  long long res = 0;
  if (m <= a + r) {
    long long count = min(add, remove);
    res += m * count;
    add -= count;
    remove -= count;
    res += add * a;
    res += remove * r;
  } else {
    res += add * a;
    res += remove * r;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> a >> r >> m;
  v.resize(n);
  for (auto& x : v) {
    cin >> x;
    sum += x;
  }
  long long l = 0;
  long long r = *max_element(v.begin(), v.end());
  while (r - l > 2) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    long long f1 = cost(m1);
    long long f2 = cost(m2);
    if (f1 > f2)
      l = m1;
    else
      r = m2;
  }
  long long res = min(cost(l), cost(r));
  if (r - l > 1) res = min(res, cost(l + 1));
  cout << res;
}
