#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
int vis[2000005];
void init() {
  for (int i = 2; i < 2000005; i++) {
    if (vis[i]) continue;
    prime.push_back(i);
    for (int j = i; j < 2000005; j += i) {
      vis[j] = 1;
    }
  }
}
int cnt[2000005];
long long sum[2000005];
long long sum2[2000005];
int main() {
  int n, x, y;
  scanf("%d%d%d", &n, &x, &y);
  int f = x / y;
  f++;
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    cnt[t]++;
  }
  for (int i = 1; i < 2000005; i++) {
    sum[i] = sum[i - 1] + cnt[i];
    sum2[i] = sum2[i - 1] + 1LL * cnt[i] * i;
  }
  init();
  long long Best = 0x3f3f3f3fLL * 0x3f3f3f3fLL * 4;
  for (int i = 0; i < prime.size(); i++) {
    long long ans = 0;
    for (int j = prime[i]; j < 2000005; j += prime[i]) {
      ans += ((sum[j] - sum[j - min(prime[i], f)]) * j -
              (sum2[j] - sum2[j - min(prime[i], f)])) *
             y;
      if (j - min(prime[i], f) > j - prime[i]) {
        ans += (sum[j - min(prime[i], f)] - sum[j - prime[i]]) * x;
      }
    }
    Best = min(ans, Best);
  }
  cout << Best << '\n';
  return 0;
}
