#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5 * 100000 + 5;
const long long UP = 2000000 + 5;
long long n;
long long x, y;
bool vis[UP];
vector<long long> prim;
long long sum[UP];
long long cnt[UP], a[maxn];
long long gcd(long long A, long long B) { return B == 0 ? A : gcd(B, A % B); }
void seive() {
  for (long long i = 2; i < UP; i++) {
    if (!vis[i]) prim.push_back(i);
    for (long long j = 0; j < (long long)prim.size(); j++) {
      if (i * prim[j] >= UP) break;
      vis[i * prim[j]] = 1;
      if (i % prim[j] == 0) break;
    }
  }
}
int main() {
  scanf("%lld%lld%lld", &n, &x, &y);
  long long ones = 0, mx = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    mx = max(mx, a[i]);
    ones += (a[i] == 1);
    cnt[a[i]]++;
  }
  for (long long i = 0; i < UP; i++)
    sum[i] = sum[i - 1] + cnt[i] * i, cnt[i] += cnt[i - 1];
  seive();
  long long gd = a[1];
  for (long long i = 2; i <= n; i++) gd = gcd(gd, a[i]);
  if (gd > 1)
    printf("0\n");
  else {
    if (ones == n) {
      printf("%lld\n", min(x * n, y * n));
    } else {
      long long Ans = LLONG_MAX;
      for (long long i = 0; i < (long long)prim.size(); i++) {
        if (prim[i] > mx) break;
        long long p = prim[i];
        long long now = 0;
        for (long long j = 1; j <= (mx / p) + 1; j++) {
          long long lef = (j - 1) * p, rgh = j * p;
          long long mid = max(lef, (long long)(rgh - (x / y) - 1));
          assert(mid >= lef);
          now += x * (cnt[mid] - cnt[lef]) +
                 ((cnt[rgh] - cnt[mid]) * rgh - (sum[rgh] - sum[mid])) * y;
        }
        Ans = min(Ans, now);
      }
      printf("%lld\n", Ans);
    }
  }
  return 0;
}
