#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void mad(long long &a, long long b) {
  a = (a + b) % 1000000007;
  if (a < 0) a += 1000000007;
}
long long gcd(long long a, long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
long long cost(long long n, long long a, long long b, long long m, long long *h,
               long long ht) {
  long long c1 = 0, c2 = 0;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] < ht)
      c1 += ht - h[i];
    else if (h[i] > ht)
      c2 += h[i] - ht;
  }
  if (a + b > m) {
    long long mini = min(c1, c2);
    c1 -= mini;
    c2 -= mini;
    res = c1 * a + c2 * b + mini * m;
  } else {
    res = c1 * a + c2 * b;
  }
  return res;
}
void solve() {
  long long n, a, b, m;
  cin >> n >> a >> b >> m;
  long long h[n];
  for (int i = 0; i < n; i++) cin >> h[i];
  long long l = 0, r = 1e9, m1, m2;
  for (int i = 0; i < 100; i++) {
    m1 = l + (r - l) / 3ll;
    m2 = r - (r - l) / 3ll;
    long long c1 = cost(n, a, b, m, h, m1);
    long long c2 = cost(n, a, b, m, h, m2);
    if (c1 < c2)
      r = m2;
    else
      l = m1;
  }
  cout << min(
      cost(n, a, b, m, h, l),
      min(cost(n, a, b, m, h, r), cost(n, a, b, m, h, l + (r - l) / 2)));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
