#include <bits/stdc++.h>
using namespace std;
long long x, y, n;
long long cnt[1000000LL + 1];
long long sum[1000000LL + 1];
bool v[1000000LL + 1];
long long min_cost_for_prime_factor(long long k) {
  long long c = x / y;
  long long cost = 0;
  c = min(c, k - 1);
  for (long long i = k; i < 1000000LL + k; i += k) {
    cost += x * (cnt[min(i - c - 1, 1000000LL)] - cnt[i - k]);
    cost +=
        y * ((cnt[min(i - 1, 1000000LL)] - cnt[min(i - c - 1, 1000000LL)]) * i -
             (sum[min(i - 1, 1000000LL)] - sum[min(i - c - 1, 1000000LL)]));
  }
  return cost;
}
int main(int argc, char** argv) {
  std::ios::sync_with_stdio(false);
  cin >> n >> x >> y;
  for (long long i = 0; i < n; ++i) {
    long a;
    cin >> a;
    cnt[a] += 1;
    sum[a] += a;
  }
  for (long long i = 1; i <= 1000000LL; ++i) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long min_cost = x * n;
  for (long long k = 2; k <= 1000000LL; ++k) {
    if (v[k]) {
      continue;
    }
    long long tmp = min_cost_for_prime_factor(k);
    if (min_cost > tmp) {
      min_cost = tmp;
    }
    for (long long j = k; j <= 1000000LL; j += k) {
      v[j] = true;
    }
  }
  cout << min_cost << endl;
}
