#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using dd = long double;
namespace {
static bool constexpr dbg = 0;
ll constexpr N = 2.1e6;
ll n, x, y, mx, d[N + 9], cnt[N + 9], sum[N + 9];
void init() {
  mx = 2;
  cin >> n >> x >> y;
  for (ll i = 1; i <= (ll)(n); ++i) {
    cin >> d[i];
    mx = max(mx, d[i]);
    ++cnt[d[i]];
    sum[d[i]] += d[i];
  }
  for (ll i = 1; i < N; ++i) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
}
bool pr[N];
void solve() {
  for (ll i = 2; i < N; ++i) pr[i] = true;
  ll res = LONG_LONG_MAX;
  for (ll p = 2; p <= mx; ++p)
    if (pr[p]) {
      for (ll j = p * p; j <= mx; j += p) pr[j] = false;
      ll cost = 0;
      for (ll j = 0;; ++j) {
        ll beg = p * j, end = p * (j + 1), b2 = max(beg, end - x / y - 1);
        cost += (end * (cnt[end] - cnt[b2]) - (sum[end] - sum[b2])) * y;
        cost += (cnt[b2] - cnt[beg]) * x;
        if (cost < 0) {
          cout << "j = " << j << ", cost = " << cost << endl;
        }
        if (end >= mx) break;
      }
      do {
        if (dbg) printf("p = %lld, cost = %lld\n", p, cost);
      } while (0);
      res = min(res, cost);
    }
  cout << res;
}
}  // namespace
int main() {
  if (!dbg) {
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  cout << fixed << setprecision(20);
  init();
  solve();
  return 0;
}
