#include <bits/stdc++.h>
using namespace std;
long long ara[2000005], she[500005], cum1[2000005], cum2[2000005];
vector<long long> vec;
const long long inf = 10000000000000000LL;
void sieve(void) {
  long long i, j, sq = 1000;
  for (i = 4; i < 1000005; i += 2) ara[i] = 1;
  for (i = 3; i <= sq; i += 2) {
    if (!ara[i]) {
      for (j = i * i; j < 1000005; j += 2 * i) ara[j] = 1;
    }
  }
  return;
}
void setup(void) {
  long long i, j;
  sieve();
  vec.push_back(2);
  for (i = 3; i < 1000000; i += 2) {
    if (!ara[i]) vec.push_back(i);
  }
  return;
}
int main() {
  long long n, i, j, k, p, q, x, y, z, a, b, c;
  setup();
  cin >> n >> x >> y;
  for (i = 1; i <= n; i++) {
    scanf("%I64d", she + i);
    cum1[she[i]]++;
    cum2[she[i]] += she[i];
  }
  for (i = 1; i <= 2000000; i++) cum1[i] += cum1[i - 1], cum2[i] += cum2[i - 1];
  z = x / y;
  b = inf;
  for (i = 0; i < vec.size(); i++) {
    q = min(vec[i] - 1, z);
    k = a = 0;
    for (j = vec[i]; j <= 2000000; j += vec[i]) {
      p = cum1[j] - cum1[j - q - 1];
      k += p;
      a += p * j - cum2[j] + cum2[j - q - 1];
    }
    b = min(b, a * y + (n - k) * x);
  }
  printf("%I64d\n", b);
  return 0;
}
