#include <bits/stdc++.h>
using namespace std;
const int N = 2002007;
long long x, y;
vector<long long> v;
long long acc[N];
int pr[N];
long long n;
long long solve() {
  long long ans = 1000000000000000000;
  long long prev, tot, cost;
  for (long long i = 2; i <= 1000100; ++i) {
    tot = cost = prev = 0;
    if (pr[i]) continue;
    for (long long j = i; j <= 2000200; j += i) {
      pr[j] = 1;
      long long l =
          upper_bound(v.begin(), v.end(), j - (x + y - 1) / y) - v.begin();
      l = max(l, prev);
      if (l >= n) break;
      long long r = upper_bound(v.begin(), v.end(), j) - v.begin();
      tot += r - l;
      prev = r;
      if (r != l)
        cost += ((j * (r - l)) - (acc[r - 1] - (l > 0 ? acc[l - 1] : 0))) * y;
      if (cost > 500000000000000ll or cost < 0) break;
    }
    cost += (n - tot) * x;
    if (cost < 0) cost = 1000000000000000000;
    ans = min(ans, cost);
  }
  return ans;
}
int main() {
  cin >> n >> x >> y;
  for (int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  acc[0] = v[0];
  for (int i = 1; i < v.size(); ++i) acc[i] = acc[i - 1] + v[i];
  cout << solve() << endl;
}
