#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5;
int arr[MAX];
int vis[MAX];
long long pref[MAX];
vector<int> pr;
void pre() {
  for (int i = 2; i < MAX; i++) {
    if (!vis[i]) {
      pr.push_back(i);
      for (int j = i; j < MAX; j += i) {
        vis[j] = 1;
      }
    }
  }
}
int main() {
  pre();
  int n;
  long long x, y;
  scanf("%d %lld %lld", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  sort(arr, arr + n);
  pref[0] = arr[0];
  for (int i = 1; i < n; i++) {
    pref[i] = pref[i - 1] + arr[i];
  }
  long long val = 1e15;
  for (int i = 0; i < pr.size(); i++) {
    int v = pr[i];
    int l = (x / y);
    l = min(l, v - 1);
    long long tmp = 0;
    for (int j = v; j < MAX + v; j += v) {
      int m = lower_bound(arr, arr + n, j - l) - arr;
      int r = upper_bound(arr, arr + n, j) - arr - 1;
      int l = upper_bound(arr, arr + n, j - v) - arr;
      if (r == -1) {
        continue;
      }
      long long cnt1 = r - m + 1;
      long long cnt2 = m - l;
      tmp += (cnt2 * 1ll * x);
      tmp += ((cnt1 * j) - pref[r] + (m >= 1 ? pref[m - 1] : 0)) * 1ll * y;
    }
    val = min(val, tmp);
  }
  printf("%lld\n", val);
  return 0;
}
