#include <bits/stdc++.h>
using namespace std;
const long long inf = 6 * 1e18;
const long long Mod = 1e9 + 7;
const long double pai = acos(-1);
long long N, Add, Remove, Move;
long long A[100009];
long long Cost(long long Goal) {
  long long More = 0, Need = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] < Goal)
      Need += Goal - A[i];
    else
      More += A[i] - Goal;
  }
  long long Mn = min(More, Need);
  More -= Mn, Need -= Mn;
  return More * Remove + Need * Add + Mn * Move;
}
long long Search(int l, int r) {
  while (r - l > 1) {
    int Mid1 = l + (r - l + 1) / 3;
    int Mid2 = r - (r - l + 1) / 3;
    if (Cost(Mid1) < Cost(Mid2))
      r = Mid2;
    else
      l = Mid1;
  }
  long long Ans = inf;
  l = max(0, l - 10), r += 10;
  for (int i = l; i <= r; i++) Ans = min(Ans, Cost(i));
  return Ans;
}
int main() {
  cin >> N >> Add >> Remove >> Move;
  Move = min(Move, Add + Remove);
  for (int i = 0; i < N; i++) cin >> A[i];
  cout << Search(0, 1e9) << endl;
}
