#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long n, x, y;
long long a[1000006], cnt[1000006], sum[1000006];
long long isprime[1000006];
vector<int> primes;
void cal() {
  memset(isprime, 1, sizeof(isprime));
  for (int i = 2; i * i <= 1000000; i++) {
    if (isprime[i]) {
      for (int j = 2 * i; j <= 1000000; j += i) isprime[j] = 0;
    }
  }
  for (int i = 2; i <= 1000000; i++)
    if (isprime[i]) primes.push_back(i);
}
int main() {
  scanf("%lld %lld %lld", &n, &x, &y);
  cal();
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    cnt[a[i]]++;
    sum[a[i]] += a[i];
  }
  for (int i = 1; i < 1000006; i++) {
    cnt[i] = cnt[i - 1] + cnt[i];
    sum[i] = sum[i - 1] + sum[i];
  }
  long long add = x / y;
  long long ans = 1e18;
  for (long long i = 0; i < primes.size(); i++) {
    long long temp = 0;
    long long prime = primes[i];
    for (long long j = prime; j < 1000001 + prime; j += prime) {
      long long r = min(1000001LL, j);
      long long l = min(1000001LL, j - prime);
      long long l1 = min(1000001LL, max(l + 1, j - add));
      if (l1 > l) temp += (cnt[l1 - 1] - cnt[l]) * x;
      if (r > l1)
        temp += ((cnt[r - 1] - cnt[l1 - 1]) * (prime + l) - sum[r - 1] +
                 sum[l1 - 1]) *
                y;
    }
    ans = min(ans, temp);
  }
  printf("%lld\n", ans);
  return 0;
}
