#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const double eps = 1e-12;
template <typename T>
inline void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
const long long N = 500010, ALL = 1000000;
long long cnt[ALL + 10], sum[ALL + 10], val[ALL + 10];
bool isp[ALL + 10];
long long n, x, y;
long long ans = 1e15;
inline long long calc(long long l, long long r, long long j, long long m) {
  long long ret = 0;
  ret += (sum[m] - sum[l]) * x;
  ret += ((sum[r] - sum[m]) * j - (val[r] - val[m])) * y;
  return ret;
}
signed main() {
  read(n);
  read(x);
  read(y);
  long long c = (x + y - 1) / y;
  for (long long i = 1; i <= n; i++) {
    long long x;
    read(x);
    ++cnt[x];
  }
  for (long long i = 1; i <= ALL; i++) {
    val[i] = val[i - 1] + cnt[i] * i;
    sum[i] = sum[i - 1] + cnt[i];
  }
  memset(isp, 1, sizeof isp);
  for (long long i = 2; i <= ALL; i++) {
    if (isp[i]) {
      long long ret = 0;
      for (long long j = i; j - i <= ALL; j += i) {
        if (j <= ALL) isp[j] = 0;
        long long v = j - c;
        v = max(v, j - i);
        v = min(v, ALL);
        ret += calc(j - i, min(ALL, j), j, v);
      }
      ans = min(ret, ans);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
