#include <bits/stdc++.h>
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int N = 2e6 + 7, inf = 1e9 + 7, mod = 1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1},
          dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
int get_int() {
  char x = getchar();
  bool mns = 0;
  while (!isdigit(x)) mns |= x == '-', x = getchar();
  int res = 0;
  while (isdigit(x)) res = res * 10 + x - '0', x = getchar();
  if (mns) res = -res;
  return res;
}
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
}
int mult(int x, int y) { return x * 1ll * y % mod; }
int sum(int x, int y) {
  add(x, y);
  return x;
}
int n;
long long X, Y;
int a[N];
long long second[N], id[N];
bool first[N];
vector<int> pr;
int count(int l, int r) { return second[r] - second[l - 1]; }
long long need(int l, int r) { return id[r] - id[l - 1]; }
long long get1(int l, int r) {
  if (l > r) return 0;
  return (long long)count(l, r) * X;
}
long long get2(int l, int r, int go) {
  if (l > r) return 0;
  return ((long long)count(l, r) * go - need(l, r)) * Y;
}
long long calc(int x) {
  int L = 1;
  long long res = 0, mn = linf;
  bool good = 0;
  for (int i = x;; L = i + 1, i += x) {
    int l = L, r = i - 1, ok = i;
    while (l <= r) {
      int mid = l + r >> 1;
      if ((i - mid) * Y <= X)
        ok = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    res += get2(ok, i - 1, i) + get1(L, ok - 1);
    if (get2(ok, i - 1, i) || count(i, i)) good = 1;
    if (get2(ok, i - 1, i) + get1(L, ok - 1)) {
    }
    l = L, r = i - 1, ok = -1;
    while (l <= r) {
      int mid = l + r >> 1;
      if (count(mid, i - 1))
        ok = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    if (ok != -1) mn = min(mn, (i - ok) * Y);
    if (i > (int)1e6) break;
  }
  return res;
  res -= X;
  res += mn;
  return res;
}
void solve() {
  n = get_int(), X = get_int(), Y = get_int();
  for (int i = 1; i <= n; i++) {
    a[i] = get_int();
    second[a[i]]++;
    id[a[i]] += a[i];
  }
  for (int i = 2; i <= (int)2e6; i++) {
    second[i] += second[i - 1];
    id[i] += id[i - 1];
    if (!first[i]) {
      pr.push_back(i);
      if (((i)*1ll * (i)) <= (int)2e6) {
        for (int j = ((i)*1ll * (i)); j <= (int)2e6; j += i) first[j] = 1;
      }
    }
  }
  long long ans = linf;
  for (auto it : pr) ans = min(ans, calc(it));
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) solve();
  exit(0);
}
