#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
const int maxn = (int)(2e6) + 5;
int cnt[maxn], chk[maxn];
long long su[maxn];
int main() {
  int n, X, Y;
  read(n);
  read(X);
  read(Y);
  int va = X / Y + 1;
  for (int i = (1); i <= (n); i++) {
    int x;
    read(x);
    cnt[x]++;
    su[x] += x;
  }
  int mx = (int)(2e6);
  long long ret = (long long)(5e18);
  for (int i = (1); i <= (mx); i++) cnt[i] += cnt[i - 1], su[i] += su[i - 1];
  for (int i = (2); i <= (mx); i++)
    if (!chk[i]) {
      long long now = 0;
      for (int j = i; j <= mx; j += i) {
        chk[j] = 1;
        int c = max(j - i, j - va);
        now += 1LL * X * (cnt[c] - cnt[j - i]) +
               1LL * Y * (1LL * j * (cnt[j] - cnt[c]) - su[j] + su[c]);
      }
      ret = min(ret, now);
    }
  printf("%I64d\n", ret);
  return 0;
}
