#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline const T read1() {
  T m = 0;
  char k = getchar();
  while (('0' > k || k > '9') && (k != '-')) k = getchar();
  const bool f = (k == '-' ? 1 : 0);
  if (f) k = getchar();
  while ('0' <= k && k <= '9')
    m = (m << 3) + (m << 1) + (k ^ 48), k = getchar();
  return f ? -m : m;
}
long long h[1000000 + 5 << 1], s, prime[1000000];
long long sum[1000000 + 5 << 1], x, y;
bool vis[1000000 + 5];
void init() {
  for (long long i = 2; i <= 1000000; ++i)
    if (!vis[i]) {
      prime[++prime[0]] = i;
      for (long long j = 1ll * i * i; j <= 1000000; j += i) vis[j] = 1;
    }
}
signed main() {
  ;
  init();
  s = read1<long long>();
  x = read1<long long>(), y = read1<long long>();
  for (long long i = 1; i <= s; ++i) {
    long long o = read1<long long>();
    ++h[o];
    sum[o] += o;
  }
  for (long long i = 1; i <= 1000000 << 1; ++i)
    h[i] += h[i - 1], sum[i] += sum[i - 1];
  long long ans = 9e18;
  long long can = x / y;
  for (long long i = 1; i <= prime[0]; ++i)
    if (h[prime[i] - 1] != h[1000000], 1) {
      long long t = 0;
      for (long long j = 0; j * prime[i] <= 1000000; ++j) {
        long long w = max(j * prime[i], (j + 1) * prime[i] - can - 1);
        t += (h[w] - h[j * prime[i]]) * x;
        t += y * (1ll * (h[(j + 1) * prime[i]] - h[w]) * (j + 1) * prime[i] -
                  sum[(j + 1) * prime[i]] + sum[w]);
        if (t > ans) break;
      }
      if (t < ans) ans = t;
    }
  printf("%lld", ans);
  return 0;
}
