#include <bits/stdc++.h>
using namespace std;
long long n, x, y, a[2 * 1000007 + 7], ans[2 * 1000007 + 7],
    num[2 * 1000007 + 7], fin, m;
long long check[1000007], prime[1000007];
long long getprime() {
  long long tot = 0;
  memset(check, false, sizeof(check));
  check[0] = check[1] = true;
  for (long long i = 2; i < 1000007; i++) {
    if (!check[i]) {
      prime[tot++] = i;
    }
    for (long long j = 0; j < tot; j++) {
      if (i * prime[j] > 1000007) {
        break;
      }
      check[i * prime[j]] = true;
      if (i % prime[j] == 0) {
        break;
      }
    }
  }
  return tot;
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> x >> y;
  long long tot = getprime();
  memset(a, 0, sizeof(a));
  memset(num, 0, sizeof(num));
  memset(ans, 0, sizeof(ans));
  for (long long i = 0; i < n; i++) {
    cin >> m;
    a[m]++;
  }
  ans[0] = num[0] = 0;
  long long tmp = (x + y - 1) / y;
  for (long long i = 1; i <= 2 * 1000007; i++) {
    num[i] = num[i - 1], num[i] += a[i];
    ans[i] = ans[i - 1], ans[i] += i * a[i];
  }
  fin = 1e18;
  for (long long i = 0; i < tot; i++) {
    long long mm = prime[i];
    long long cnt = 0;
    for (long long j = mm; j <= 1000007 + mm; j += mm) {
      if (num[j - 1] - num[j - mm] > 0) {
        if (mm <= tmp) {
          cnt +=
              y * ((num[j - 1] - num[j - mm]) * j - (ans[j - 1] - ans[j - mm]));
        } else {
          cnt += x * (num[j - tmp] - num[j - mm]) +
                 y * ((num[j - 1] - num[j - tmp]) * j -
                      (ans[j - 1] - ans[j - tmp]));
        }
      }
    }
    fin = min(fin, cnt);
  }
  cout << fin << endl;
  return 0;
}
