#include <bits/stdc++.h>
using namespace std;
const long long N = 1000005;
long long n, A, R, M, a[N];
long long check(long long x) {
  long long ans = 0;
  long long u = 0, b = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] > x) u += a[i] - x;
    if (a[i] < x) b += x - a[i];
  }
  long long d = abs(u - b), m = min(u, b);
  if (u > b) ans += d * R;
  if (b > u) ans += d * A;
  ans += m * M;
  return ans;
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> A >> R >> M;
  if (A + R < M) M = A + R;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long l = 0, r = 1e9;
  while (l < r) {
    long long m1 = (2 * l + r) / 3, m2 = (2 * r + l + 2) / 3;
    if (check(m1) < check(m2))
      r = m2 - 1;
    else
      l = m1 + 1;
  }
  cout << check(l) << endl;
}
