#include <bits/stdc++.h>
using namespace std;
long long n, x, y, primo[2100006];
long long cnt[2100006], sum[2100006];
long long qtd(int l, int r) {
  if (l > r) return 0;
  if (l == 0) return cnt[r];
  return cnt[r] - cnt[l - 1];
}
long long acc(int l, int r) {
  if (l > r) return 0;
  if (l == 0) return sum[r];
  return sum[r] - sum[l - 1];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
    sum[x] += x;
  }
  for (int i = 1; i < 2100006; i++) cnt[i] += cnt[i - 1];
  for (int i = 1; i < 2100006; i++) sum[i] += sum[i - 1];
  long long ans = n * x, d;
  for (int i = 2; i < 2100006; i++) {
    if (primo[i] != 0) continue;
    for (int j = i; j < 2100006; j += i) primo[j] = 1;
    d = min(x / y, i - 1LL);
    long long cost = 0;
    for (int j = i; j < 2100006; j += i) {
      if (qtd(j - d, j - 1) * j - acc(j - d, j - 1) == 0) {
      } else if (log(ans) + 1 <
                 log(y) + log(qtd(j - d, j - 1) * j - acc(j - d, j - 1))) {
        cost = n * x;
        break;
      }
      cost += x * qtd(j - i + 1, j - d - 1) +
              y * (qtd(j - d, j - 1) * j - acc(j - d, j - 1));
    }
    ans = min(ans, cost);
  }
  cout << ans << endl;
}
