#include <bits/stdc++.h>
using namespace std;
int N = 1000005;
bitset<2000005> p;
vector<int> ps, f[1000005];
int a[1000005], n, x, y, b[1000006];
vector<pair<int, int>> v;
void init() {
  p.set();
  p[1] = p[0] = 0;
  for (int i = 2; i <= N; i++)
    if (p[i]) {
      f[i].push_back(i);
      for (int j = i + i; j <= N; j += i) {
        p[j] = false;
        f[j].push_back(i);
      }
    }
}
inline long long check(int d) {
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] % d == 0) continue;
    ans += min(1LL * x, 1LL * (d - (a[i] % d)) * y);
  }
  return ans;
}
int main() {
  init();
  scanf("%d%d%d", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < f[a[i]].size(); j++) {
      b[f[a[i]][j]]++;
    }
  }
  long long ans = -1;
  for (int i = 2; i <= 1000000; i++) {
    if (!b[i]) continue;
    v.push_back(make_pair(b[i], i));
  }
  sort(v.begin(), v.end(), greater<pair<int, int>>());
  ans = check(2);
  for (int i = 0; i < min((int)v.size(), 30); i++) {
    ans = min(ans, check(v[i].second));
  }
  printf("%lld\n", ans);
  return 0;
}
