#include <bits/stdc++.h>
using namespace std;
bool vis[2000007];
bool mark[2000007];
vector<long long> v[2000007];
vector<long long> primes;
long long lagbe[2000007];
long long arr[2000007];
long long cum[2000007];
long long cnt[2000007];
void sieve(long long x, long long y) {
  mark[1] = true;
  for (long long i = 2; i < 2000007; i++) {
    if (!mark[i]) {
      for (long long j = i; j < 2000007; j += i) {
        if (i != j) mark[j] = true;
        long long now = max(j - i, j - x / y - 1);
        lagbe[i] = lagbe[i] +
                   ((cnt[j - 1] - cnt[now]) * j - cum[j - 1] + cum[now]) * y;
        if (now > j - i) lagbe[i] = lagbe[i] + (cnt[now] - cnt[j - i]) * x;
      }
      primes.push_back(i);
    }
  }
}
long long pos[2000007];
int main() {
  long long i, j, k, l, n, x, y;
  cin >> n >> x >> y;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    pos[arr[i]] += arr[i];
  }
  sort(arr, arr + n);
  for (i = 1; i < 2000007; i++) {
    cum[i] = cum[i - 1] + pos[i];
    if (pos[i] > 0)
      cnt[i] = cnt[i - 1] + pos[i] / i;
    else
      cnt[i] = cnt[i - 1];
  }
  sieve(x, y);
  long long ans = x * n;
  for (i = 0; i < primes.size(); i++) {
    ans = min(ans, lagbe[primes[i]]);
  }
  cout << ans << endl;
  return 0;
}
