#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
const long double PI = acos(-1);
int n, a[N];
long long x, y = 0;
bool vis[N];
long long acc1[N];
long long acc2[N];
long long solve() {
  long long ans = LLONG_MAX;
  for (int i = 2; i < N; i++) {
    int lo = 1, hi = i;
    long long res = 0;
    while (lo < hi) {
      int md = lo + (hi - lo) / 2;
      if (x > 1ll * (i - md) * y)
        hi = md;
      else
        lo = md + 1;
    }
    for (int j = i; j < N; j += i) {
      res += (acc1[j - i + lo - 1] - acc1[j - i]) * 1ll * x;
      res += (((acc1[j] - acc1[j - i + lo - 1]) * 1ll * j) -
              (acc2[j] - acc2[j - i + lo - 1])) *
             1ll * y;
    }
    ans = min(ans, res);
  }
  return ans;
}
void read() {
  scanf("%d%lld%lld", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    acc1[a[i]]++;
    acc2[a[i]] += a[i];
  }
  for (int i = 1; i < N; i++) acc1[i] += acc1[i - 1], acc2[i] += acc2[i - 1];
}
int main() {
  read();
  printf("%lld\n", solve());
  return 0;
}
