#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 17;
const int MAXM = 20;
const int MAXV = 2 * 1e3 + 17;
const int INF = 0x7fffffff;
const long long INFF = 0x7fffffffffffffff;
const int MOD = 1e9 + 7;
long long prime[MAXN];
long long vis[MAXN];
long long cnt;
void get() {
  memset(vis, 0, sizeof(vis));
  cnt = 0;
  for (int i = 2; i < MAXN; i++) {
    if (!vis[i]) {
      prime[++cnt] = i;
      for (int j = i + i; j < MAXN; j += i) {
        vis[j] = 1;
      }
    }
  }
}
long long a[2 * MAXN], c[2 * MAXN], tms[2 * MAXN], sum[2 * MAXN];
int main() {
  get();
  long long n, x, y, gst = 0;
  cin >> n >> x >> y;
  for (int i = 0; i < n; ++i) {
    scanf("%lld", a + i);
    tms[a[i]]++;
    sum[a[i]] += a[i];
    gst = max(gst, a[i]);
  }
  for (int i = 1; i <= 2 * MAXN; ++i) {
    tms[i] += tms[i - 1];
    sum[i] += sum[i - 1];
  }
  long long ans = INFF, delta = x / y, ori = delta;
  for (int i = 1; i <= cnt; ++i) {
    if (prime[i] > 2 * gst) break;
    long long p = prime[i];
    long long del = 0, inc = 0, sinc = 0, temp = 0;
    for (long long j = p; j <= gst + p; j += p) {
      if (delta < p - 1) {
        del = tms[j - delta - 1] - tms[j - p];
        inc = sum[j - 1] - sum[j - delta - 1];
        sinc = tms[j - 1] - tms[j - delta - 1];
      } else {
        inc = sum[j - 1] - sum[j - p];
        sinc = tms[j - 1] - tms[j - p];
      }
      temp += del * x + (sinc * j - inc) * y;
      if (temp >= ans) break;
    }
    ans = min(temp, ans);
  }
  cout << ans << endl;
  return 0;
}
