#include <bits/stdc++.h>
using namespace std;
vector<bool> primes(1e6 + 1, true);
vector<long long> primeList;
void calcPrimes() {
  for (int i = 2; i <= 1000; i++) {
    if (primes[i]) {
      primeList.push_back(i);
      int curr = i * i;
      while (curr <= 1000000) {
        primes[curr] = false;
        curr += i;
      }
    }
  }
  for (int i = 1001; i <= 1e6; i++) {
    if (primes[i]) {
      primeList.push_back(i);
    }
  }
}
long long prime(long long val) {
  if (primes[val]) return val;
  for (int i : primeList) {
    if (val % i == 0) {
      return i;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, x, y;
  cin >> n >> x >> y;
  calcPrimes();
  vector<long long> vals(2e6 + 1), tot(2e6 + 1);
  for (int i = 0; i < n; i++) {
    int cur;
    cin >> cur;
    vals[cur] += cur;
    tot[cur]++;
  }
  vector<long long> cumVals = {0}, cumTot = {0};
  for (int i = 1; i < 2e6 + 1; i++) {
    cumVals.push_back(cumVals[i - 1] + vals[i]);
    cumTot.push_back(cumTot[i - 1] + tot[i]);
  }
  for (int i = 0; i < 20; i++) {
  }
  long long bestAns = x * vals.size();
  for (int i = 0; i < primeList.size(); i++) {
    long long curAns = 0;
    long long curP = primeList[i];
    for (int j = curP; j <= 1e6 + curP; j += curP) {
      long long thresh = max(j - curP, j - x / y - 1);
      curAns += y * (j * (cumTot[j] - cumTot[thresh]) -
                     (cumVals[j] - cumVals[thresh]));
      curAns += x * (cumTot[thresh] - cumTot[j - curP]);
    }
    if (curAns < bestAns) {
      bestAns = curAns;
    }
  }
  cout << bestAns << endl;
  return 0;
}
