#include <bits/stdc++.h>
using namespace std;
int n;
long long x, y;
bool isprime[1001000];
long long a[1001000], pre[1001000];
vector<int> prime;
int cal(int L, int R, int to) {
  if (y * (to - a[L]) <= x) return L - 1;
  while (L != R) {
    int mid = (L + R + 1) / 2;
    if (y * (to - a[mid]) <= x) {
      R = mid - 1;
    } else {
      L = mid;
    }
  }
  return L;
}
int main() {
  scanf("%d%lld%lld", &n, &x, &y);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) {
    pre[i] = pre[i - 1] + a[i];
  }
  for (int i = 2; i <= a[n] + 1; ++i) {
    if (isprime[i]) continue;
    prime.push_back(i);
    for (int j = i + i; j <= a[n] + 1; j += i) {
      isprime[j] = true;
    }
  }
  long long ans = 1e18;
  for (auto &i : prime) {
    int L = 1;
    long long res = 0;
    for (int T = 1; L <= n; ++T) {
      int R = (int)(upper_bound(a + 1, a + n + 1, i * T) - a) - 1;
      if (L > R) continue;
      int hal = cal(L, R, T * i);
      res += x * (hal - L + 1);
      res += y * (1LL * (R - hal) * T * i - (pre[R] - pre[hal]));
      L = R + 1;
    }
    ans = min(ans, res);
  }
  printf("%lld\n", ans);
  return 0;
}
