#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 998244353;
long long n, A, R, M;
long long arr[N], sum;
long long prefSum[N];
long long cal(long long mid) {
  long long newSum = n * mid;
  long long ans;
  if (newSum > sum)
    ans = (newSum - sum) * A;
  else
    ans = (sum - newSum) * R;
  int idx = upper_bound(arr, arr + n, mid) - arr;
  long long cnt = 0;
  if (newSum > sum) {
    cnt = idx * mid - prefSum[idx] - abs(newSum - sum);
  } else {
    cnt = (prefSum[n] - prefSum[idx]) - ((n - idx) * mid);
    cnt -= abs(newSum - sum);
  }
  ans += cnt * M;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> A >> R >> M;
  sum = 0;
  if (A + R < M) M = A + R;
  for (int i = 0; i < n; ++i) cin >> arr[i], sum += arr[i];
  sort(arr, arr + n);
  for (int i = 0; i < n; ++i) prefSum[i + 1] = prefSum[i] + arr[i];
  long long mnSum = arr[0] * n;
  long long mxSum = arr[n - 1] * n;
  long long l = mnSum / n;
  long long r = (sum + n - 1) / n;
  long long ans = cal(l);
  while (l < r) {
    long long m = (l + r) / 2;
    long long temp = cal(m);
    if (temp < ans)
      l = m, ans = temp;
    else
      r = m - 1;
  }
  l = (sum) / n;
  r = 1e9;
  long long ans2 = cal(r);
  while (l < r) {
    long long m = (l + r) / 2;
    long long temp = cal(m);
    if (temp < ans2)
      r = m, ans2 = temp;
    else
      l = m + 1;
  }
  ans = min(ans, ans2);
  ans = min(ans, cal(sum / n));
  ans = min(ans, cal((sum + n - 1) / n));
  for (int i = 0; i < n; ++i) {
    ans = min(ans, cal(arr[i]));
  }
  cout << ans << endl;
}
