#include <bits/stdc++.h>
using namespace std;
long long f[2000100ll] = {0}, sum[2000100ll] = {0};
int sp[2000100ll];
int main() {
  for (int i = 1; i < 2000100ll; ++i) {
    if (i & 1)
      sp[i] = i;
    else
      sp[i] = 2;
  }
  for (int i = 3; i * i < 2000100ll; ++i) {
    if (sp[i] != i) continue;
    for (int j = i * i; j < 2000100ll; j += i) {
      if (sp[j] == j) sp[j] = i;
    }
  }
  int n;
  long long x, y, r;
  scanf("%d %lld %lld", &n, &x, &y);
  r = x / y;
  for (int i = 0; i < n; ++i) {
    int j;
    scanf("%d", &j);
    sum[j] += 2000100ll - j;
    ++f[j];
  }
  for (int i = 2000100ll - 2; i >= 0; --i) sum[i] += sum[i + 1];
  for (int i = 1; i < 2000100ll; ++i) f[i] += f[i - 1];
  long long ans = 1e18;
  for (long long i = 2; i < 2000100ll; ++i) {
    if (sp[i] != i) continue;
    long long res = 0;
    long long g = min(r, i - 1);
    for (long long j = i; j < 2000100ll; j += i) {
      res += (f[j - g - 1] - f[j - i]) * x;
      res +=
          (sum[j - g] - sum[j] - (f[j - 1] - f[j - g - 1]) * (2000100ll - j)) *
          y;
    }
    ans = min(ans, res);
  }
  printf("%lld\n", ans);
  return 0;
}
