#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int n;
long long x, y;
long long a[maxn];
long long mp[maxn];
long long have[maxn];
bool sieve[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x >> y;
  bool allone = true;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    have[a[i]]++;
    if (a[i] > 1) allone = false;
  }
  if (allone) {
    long long cost = min(x * n, y * n);
    out(cost);
  }
  for (long long i = 2; i <= (int)1e6; i++) {
    if (!sieve[i]) {
      for (long long j = i; j <= (int)1e6; j += i) {
        sieve[j] = true;
        mp[i] += have[j];
      }
    }
  }
  long long tot = x * n;
  {
    long long odd = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2) odd++;
    }
    long long cur = odd * min(x, y);
    tot = min(cur, tot);
  }
  long long fac = -1;
  vector<pair<long long, long long>> best;
  for (int i = 2; i <= (int)1e6; i++) {
    if (mp[i]) {
      best.push_back({mp[i], i});
    }
  }
  sort(best.rbegin(), best.rend());
  best.resize(min((int)best.size(), 10));
  for (auto p : best) {
    fac = p.second;
    long long cur = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % fac == 0) continue;
      long long nxt = (a[i] / fac + 1) * fac;
      long long cost = y * (nxt - a[i]);
      cur += min(cost, x);
    }
    tot = min(cur, tot);
  }
  cout << tot << endl;
  return 0;
}
