#include <bits/stdc++.h>
using namespace std;
long long N, X, Y, mer, range, i, j, sem, has, A;
long long prefcnt[2000000 + 1], prefsum[2000000 + 1];
bool nop[2000000 + 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> Y >> X;
  mer = Y / X;
  while (N--) {
    cin >> A;
    prefcnt[A]++;
  }
  for (i = 1; i <= 2000000; i++) {
    prefcnt[i] += prefcnt[i - 1];
  }
  for (i = 1; i <= 2000000; i++) {
    prefsum[i] = prefsum[i - 1] + prefcnt[i - 1];
  }
  for (i = 2; i <= 1414; i++) {
    if (nop[i]) {
      continue;
    }
    for (j = i * i; j <= 2000000; j += i) {
      nop[j] = 1;
    }
  }
  has = LLONG_MAX;
  for (i = 2; i <= 2000000; i++) {
    if (!nop[i]) {
      sem = 0;
      for (j = i; j <= 2000000; j += i) {
        range = min(i, mer + 1);
        sem += X * (prefsum[j] - prefsum[j - range] -
                    (long long)range * prefcnt[j - range]);
        sem += Y * (prefcnt[j - range] - prefcnt[j - i]);
      }
      has = min(has, sem);
    }
  }
  cout << has << "\n";
}
