#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
int tot = 0, prime[100000];
bool isprime[MAX];
int c[MAX * 2];
long long sum[MAX * 2];
void init() {
  memset(isprime, 1, sizeof(isprime));
  isprime[1] = false;
  for (int i = 2; i < MAX; i++) {
    if (isprime[i]) prime[++tot] = i;
    for (int j = 1; j <= tot && i * prime[j] < MAX; j++) {
      isprime[i * prime[j]] = false;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  init();
  int n;
  long long x, y;
  scanf("%d%I64d%I64d", &n, &x, &y);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    c[x]++;
  }
  for (int i = 1; i < 2 * MAX; i++) {
    sum[i] += sum[i - 1] + (long long)c[i] * i;
    c[i] += c[i - 1];
  }
  int d = x / y;
  long long ans = n * x;
  for (int i = 1; i <= tot; i++) {
    int p = prime[i];
    long long now = 0;
    for (int j = 0; j <= MAX; j += p) {
      int low = max(p + j - d - 1, j);
      now += (c[low] - c[j]) * x + ((long long)(c[p + j] - c[low]) * (p + j) -
                                    (sum[p + j] - sum[low])) *
                                       y;
    }
    ans = min(ans, now);
  }
  printf("%I64d\n", ans);
  return 0;
}
