#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
bool debug = 1;
const int MAXN = 1e6 + 10;
long long soma[MAXN + 10];
long long cnt[MAXN + 10];
int main() {
  long long n, x, y;
  scanf("%lld%lld%lld", &n, &x, &y);
  for (int i = 0; i < n; i++) {
    long long v;
    scanf("%lld", &v);
    cnt[v]++;
    soma[v] += v;
  }
  for (int i = 1; i <= MAXN; i++) {
    soma[i] += soma[i - 1];
    cnt[i] += cnt[i - 1];
  }
  long long minc = LLONG_MAX;
  long long f = x / y;
  for (int i = 2; i <= MAXN - 1; i++) {
    long long cur = 0;
    long long j = 1;
    long long l = 1;
    long long r = i;
    bool sai = 0;
    while (1) {
      long long k = r;
      if (r > MAXN) {
        r = MAXN;
        if (l >= MAXN) {
          break;
        }
        sai = 1;
      }
      long long mid = max(l, r - f);
      cur += x * (cnt[mid - 1] - cnt[l - 1]) +
             y * ((cnt[r] - cnt[mid - 1]) * k - (soma[r] - soma[mid - 1]));
      if (sai) break;
      l += i;
      r += i;
    }
    minc = min(minc, cur);
  }
  cout << minc << endl;
  return 0;
}
