#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5e5 + 50;
const int MAX_A = 1e6 + 50;
long long sum[MAX_A * 2], cnt[MAX_A * 2];
int prime[MAX_A];
bool is_prime[MAX_A];
int p = 0;
int init() {
  for (int i = 0; i <= MAX_A; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= MAX_A; i++) {
    if (is_prime[i]) {
      prime[p++] = i;
      for (int j = 2 * i; j <= MAX_A; j += i) is_prime[j] = false;
    }
  }
  return p;
}
int main() {
  long long n, x, y, maxnum = LONG_LONG_MIN;
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    sum[tmp] += tmp;
    cnt[tmp]++;
    maxnum = max(tmp, maxnum);
  }
  for (int i = 1; i <= maxnum * 2; i++) {
    sum[i] += sum[i - 1];
    cnt[i] += cnt[i - 1];
  }
  init();
  long long ans = LONG_LONG_MAX;
  long long rate = x / y;
  for (long long j = 0; j < p && prime[j] <= 2 * maxnum; j++) {
    long long tmpcost = 0;
    long long k = prime[j];
    for (long long i = k; i - k <= maxnum; i += k) {
      long long limit = max(i - k + 1, i - rate);
      long long cancel = (cnt[limit - 1] - cnt[i - k]) * x;
      long long addcost =
          y * ((cnt[i] - cnt[limit - 1]) * i - (sum[i] - sum[limit - 1]));
      tmpcost += cancel + addcost;
    }
    ans = min(tmpcost, ans);
  }
  cout << ans << endl;
  return 0;
}
