#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
const int N = 1e6 + 5;
bool notp[2 * N];
int cnt[2 * N];
long long cnt2[2 * N];
int query(int ta[], int l, int r) {
  int res = ta[r];
  if (l - 1 >= 0) res -= ta[l - 1];
  return res;
}
long long query(long long ta[], int l, int r) {
  long long res = ta[r];
  if (l - 1 >= 0) res -= ta[l - 1];
  return res;
}
int main() {
  for (int i = 2; i < N; i++)
    if (!notp[i]) {
      prime.push_back(i);
      for (long long j = 1LL * i * i; j < N; j += i) notp[j] = true;
    }
  int n;
  long long up, del;
  cin >> n >> del >> up;
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    cnt[t]++;
    cnt2[t] += t;
  }
  for (int i = 1; i < 2 * N; i++) {
    cnt[i] += cnt[i - 1];
    cnt2[i] += cnt2[i - 1];
  }
  long long ans = LLONG_MAX;
  for (int i : prime) {
    long long res = 0;
    for (int j = i; j < N + i; j += i) {
      pair<int, int> t(max(j - i + 1LL, j - del / up), j - 1);
      if (t.first <= t.second) {
        res += (1LL * query(cnt, t.first, t.second) * j -
                query(cnt2, t.first, t.second)) *
               up;
      }
      if (t.first - 1 >= j - i + 1) {
        res += del * query(cnt, j - i + 1, t.first - 1);
      }
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}
