#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long A, R, M;
vector<long long> a, b;
long long check(long long sz) {
  long long ex = 0, cost = 0;
  b = a;
  for (long long &i : b) {
    if (i > sz) {
      ex += i - sz;
      i = sz;
    }
  }
  for (long long &i : b) {
    if (i < sz) {
      if (ex == 0 and A < M) {
        cost += (sz - i) * A;
      } else if (ex > 0 and A + R < M) {
        cost += (sz - i) * A;
      } else {
        long long used = min(sz - i, ex);
        cost += used * M;
        i += used;
        ex -= used;
        cost += (sz - i) * A;
      }
      i = sz;
    }
  }
  cost += R * ex;
  return cost;
}
long long TernarySearch(long long s, long long e) {
  if (s <= e) {
    long long mid1 = s + (e - s) / 3;
    long long mid2 = e - (e - s) / 3;
    long long c1 = check(mid1);
    long long c2 = check(mid2);
    if (c1 > c2) {
      return min(c2, TernarySearch(mid1 + 1, e));
    } else if (c1 < c2) {
      return min(c1, TernarySearch(s, mid2 - 1));
    } else {
      return min(c1, TernarySearch(mid1 + 1, mid2 - 1));
    }
  }
  return inf;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n >> A >> R >> M;
  long long mini = inf, maxi = 0;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mini = min(mini, a[i]);
    maxi = max(maxi, a[i]);
  }
  cout << TernarySearch(mini, maxi) << "\n";
  return 0;
}
