#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int maxn = 2e6 + 10;
long long cnt, prime[maxn], a[maxn], sum[maxn], s2[maxn];
bool vis[maxn];
void init() {
  for (int i = 2; i < maxn; i++) {
    if (vis[i]) continue;
    prime[cnt++] = i;
    for (int j = i + i; j < maxn; j += i) vis[j] = 1;
  }
}
int main() {
  init();
  long long n, x, y;
  cin >> n >> x >> y;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    int t = read();
    a[t]++;
    mx = max(mx, t);
  }
  for (int i = 1; i < maxn; i++) {
    sum[i] = sum[i - 1] + a[i];
    s2[i] = s2[i - 1] + i * a[i];
  }
  long long ans = INFLL;
  for (int t = 0; t < cnt; t++) {
    long long p = prime[t];
    long long mi = 0;
    for (long long i = 0; i * p < maxn; i++) {
      long long l = i * p, r = (i + 1) * p;
      if (r > maxn) break;
      long long bound = min(p - 1, x / y);
      mi += (sum[r - bound - 1] - sum[l]) * x;
      if (mi > ans) break;
      long long cc = sum[r - 1] - sum[r - bound - 1];
      mi += (cc * r - (s2[r - 1] - s2[r - bound - 1])) * y;
    }
    ans = min(ans, mi);
  }
  cout << ans << endl;
  return 0;
}
