#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 2;
const long long INF = 1e18;
int n;
long long x, y;
int a[N], ap[N];
long long ps[N];
bool prim[N];
long long mc = INF;
long long sumap[N];
long long get(int i, int j) {
  if (!i) return ps[j];
  return ps[j] - ps[i - 1];
}
long long get2(int i, int j) {
  if (!i) return sumap[j];
  return sumap[j] - sumap[i - 1];
}
int main() {
  scanf("%d%lld%lld", &n, &x, &y);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    ++ap[a[i]];
    ++ps[a[i]];
  }
  for (int i = 2; i < N; ++i) ps[i] += ps[i - 1];
  mc = x * n;
  for (int i = 1; i < N; ++i) {
    sumap[i] = 1LL * i * ap[i];
    sumap[i] += sumap[i - 1];
  }
  for (int i = 2; i < N; ++i) {
    prim[i] = 1;
  }
  for (int i = 2; i < N; ++i) {
    if (prim[i]) {
      for (int j = i + i; j < N; j += i) prim[j] = 0;
    }
  }
  for (int i = 2; i < N; ++i) {
    if (!prim[i]) continue;
    long long cnow = 0;
    for (int g = 0; g < N; g += i) {
      int start = g + 1, stop = min(N - 1, g + i - 1);
      int point1 = max(start, stop + 1 - int(x / y));
      int ko = 0;
      while (point1 >= start && x > (stop + 1 - point1) * y) --point1;
      if (point1 >= start) cnow += get(start, point1) * x;
      ++point1;
      if (point1 <= stop) {
        long long val = (stop + 1) * get(point1, stop) - get2(point1, stop);
        cnow += val * y;
      }
    }
    mc = min(mc, cnow);
  }
  printf("%I64d", mc);
}
