#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const int M = 1e9 + 7;
const double eps = 1e-6;
int n;
long long ans = 1LL << 60, x, y;
int pr[N], a[N], s[N], mx;
map<int, int> mp;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> x >> y;
  for (int i = 0; i < (n); i++) cin >> a[i], s[a[i]]++, mx = max(mx, a[i]);
  int t = x / y;
  t = min(mx + t + 1, N - 1);
  for (int i = (2); i <= (t); i++)
    if (!pr[i]) {
      int tmp = s[i];
      for (int k = i * 2; k <= t; k += i) {
        pr[k] = 1;
        tmp += s[k];
      }
      if ((n - tmp) * min(x, y) >= ans) continue;
      long long val = 0;
      for (int j = 0; j < (n); j++)
        if (a[j] % i) val += min(x, (i - (a[j] % i)) * y);
      ans = min(val, ans);
    }
  cout << ans << endl;
}
