#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
long long n, a, r, m, h[N], sum, up, down, cumup[N], cumdown[N],
    inf = 1e9, ans = inf * inf, avg;
int main() {
  scanf("%lld%lld%lld%lld", &n, &a, &r, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &h[i]);
    sum += h[i];
  }
  avg = sum / n;
  sort(h + 1, h + n + 1);
  for (int i = 1; i <= n; i++) cumup[i] = cumup[i - 1] + inf - h[i];
  for (int i = n; i >= 1; i--) cumdown[i] = cumdown[i + 1] + h[i];
  for (int i = 1; i <= n; i++) {
    long long down = cumdown[i] - (n - i + 1) * h[i];
    long long up = cumup[i] - i * (inf - h[i]);
    ans = min({ans, r * down + a * up,
               min(down, up) * m +
                   (max(down, up) - min(down, up)) * (down > up ? r : a)});
  }
  for (int i = 1; i <= n; i++) {
    if (h[i] > avg)
      down += h[i] - avg;
    else
      up += avg - h[i];
  }
  ans = min({ans, r * down + a * up,
             min(down, up) * m +
                 (max(down, up) - min(down, up)) * (down > up ? r : a)});
  down = up = 0;
  for (int i = 1; i <= n; i++) {
    if (h[i] > avg + 1)
      down += h[i] - avg - 1;
    else
      up += avg + 1 - h[i];
  }
  ans = min({ans, r * down + a * up,
             min(down, up) * m +
                 (max(down, up) - min(down, up)) * (down > up ? r : a)});
  printf("%lld\n", ans);
}
