#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[3000005], b[3000005];
long long d[3000005];
long long l1, l2;
void prime(int x) {
  memset(b, 0, sizeof(b));
  b[0] = b[1] = 1;
  for (int i = 2; i <= x; i++) {
    if (b[i]) continue;
    for (int j = 2; i * j <= x; j++) {
      b[i * j] = 1;
    }
  }
  return;
}
int main() {
  scanf("%d%d%d", &n, &l1, &l2);
  memset(a, 0, sizeof(a));
  m = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    m = max(m, x);
    a[x]++, d[x] += x;
  }
  for (int i = 1; i <= m << 1; i++) a[i] += a[i - 1], d[i] += d[i - 1];
  long long l3 = l1 / l2;
  prime(m << 1);
  long long p = ((unsigned long long)(-1) >> 1);
  for (int i = 2; i <= m << 1; i++) {
    if (b[i]) continue;
    long long k = 0;
    for (int j = 1; i * (j - 1) <= m; j++) {
      k += l1 * (a[max(i * (j - 1ll), i * j - l3 - 1)] + 0ll - a[i * (j - 1)]);
      k += l2 * (i * 1ll * j *
                     (a[i * j] + 0ll - a[max(i * (j - 1ll), i * j - l3 - 1)]) -
                 d[i * j] + 0ll + d[max(i * (j - 1ll), i * j - l3 - 1)]);
    }
    p = min(p, k);
  }
  printf("%lld", p);
  return 0;
}
