#include <bits/stdc++.h>
using namespace std;
namespace IO {
struct q_instream {
  template <typename classT>
  inline q_instream operator>>(classT &e) const {
    e = 0;
    classT f = 1, c = 0;
    while (c < '0' || c > '9') {
      if (c == '-') f = -1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') e = e * 10 + c - '0', c = getchar();
    return e = e * f, (*this);
  }
} in;
struct q_outstream {
  template <typename classT>
  inline q_outstream operator<<(const classT &e) const {
    if (e < 0) {
      putchar('-');
      (*this) << -e;
    } else {
      if (e > 9) (*this) << (e / 10);
      putchar(e % 10 + '0');
    }
    return (*this);
  }
  inline q_outstream operator<<(const char &c) const {
    return putchar(c), (*this);
  }
} out;
}  // namespace IO
using namespace IO;
long long b[105000];
long long n, a, r, m;
long long sum;
vector<long long> h;
vector<long long> cum(n + 1);
long long get_cost(long long x) {
  auto res = 0LL;
  if (sum < x * n) {
    res += a * (x * n - sum);
    long long j = upper_bound(begin(h), end(h), x) - begin(h);
    res += min(m, a + r) * (cum[j] - (n - j) * x);
  } else {
    res += r * (sum - x * n);
    long long j = lower_bound(begin(h), end(h), x) - begin(h);
    res += min(m, a + r) * (j * x - (cum[0] - cum[j]));
  }
  return res;
};
long long maxe = 100;
long long pos[1000];
long long best_ans = 0x3f3f3f3f3f3f3f3f;
const double BeginT = 10000, EndT = 1e-10, ChangeT = 0.999;
long long y;
typedef std::subtract_with_carry_engine<std::uint_fast64_t, 48, 5, 12>
    ranlux48_base;
ranlux48_base rb;
void SA(long long times) {
  long long x, pre, tmp_ans;
  while (times--) {
    for (double T = BeginT; T > EndT; T *= ChangeT) {
      pre = x;
      x = (b[1] + (long long)((long long)(rb()) * ChangeT)) %
              (b[n] + 1 - b[1]) +
          1;
      x += rb() % 2;
      x -= rb() % 2;
      tmp_ans = get_cost(x);
      if (tmp_ans <= best_ans) {
        best_ans = tmp_ans;
        y = x;
      } else if (exp((best_ans - tmp_ans) / T) > (double)rand() / RAND_MAX) {
        x = pre;
      }
    }
  }
  return;
}
signed main() {
  cin >> n >> a >> r >> m;
  long long o;
  for (long long i = 1; i <= n; i++) cin >> b[i], h.push_back(b[i]);
  sort(b + 1, b + n + 1);
  sort(begin(h), end(h));
  sum = accumulate(begin(h), end(h), 0LL);
  for (long long i = 0; i <= n; i++) cum.push_back(0);
  for (long long i = n; i--;) {
    cum[i] = h[i] + cum[i + 1];
  }
  SA(25);
  for (long long i = 1; i <= n; i++) best_ans = min(best_ans, get_cost(b[i]));
  for (long long i = max(y - 6005000, (long long)1); i <= y + 6005000; i++) {
    best_ans = min(best_ans, get_cost(i));
  }
  cout << best_ans << endl;
  return 0;
}
