#include <bits/stdc++.h>
using namespace std;
long long cnt[2100007], sum[2100007];
int main() {
  long long n, x, y, res;
  cin >> n >> x >> y;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 2100007; i++) {
    cnt[i] = 0;
    sum[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cnt[a[i]] += 1;
    sum[a[i]] += a[i];
  }
  for (int i = 0; i < 2100007 - 1; i++) {
    cnt[i + 1] += cnt[i];
    sum[i + 1] += sum[i];
  }
  res = n * (long long)x;
  long long temp;
  int f;
  int p, q;
  temp = 0;
  for (int g = 2; g <= 1000000; g++) {
    temp = 0;
    for (int k = g; k <= 1000000 + g; k += g) {
      q = (x + y - 1) / y;
      f = k - g;
      if (f < k - q) f = k - q;
      temp +=
          (cnt[f] - cnt[k - g]) * (long long)x +
          ((cnt[k] - cnt[f]) * (long long)k - (sum[k] - sum[f])) * (long long)y;
    }
    if (temp >= 0) {
      res = min(res, temp);
    }
  }
  cout << res << endl;
  return 0;
}
