#include <bits/stdc++.h>
using namespace std;
const int maxn = 2100000;
long long f[maxn];
int g[maxn];
int s[maxn];
int a[maxn];
int main() {
  int n, x, y;
  scanf("%d%d%d", &n, &x, &y);
  int z = x / y;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[a[i]]++;
  }
  for (int i = 1; i <= 2000000; i++) {
    f[i] = f[i - 1] + 1LL * s[i] * i;
    g[i] = g[i - 1] + s[i];
  }
  long long ans = 100000000000000000LL;
  for (int i = 2; i <= 1000000; i++) {
    long long cost = 0;
    for (int j = i; j <= 2000000; j += i) {
      long long num = g[j] - g[j - i];
      long long sum = f[j] - f[j - i];
      if (i > z) {
        num -= g[j - z - 1] - g[j - i];
        sum -= f[j - z - 1] - f[j - i];
        cost += 1LL * (g[j - z - 1] - g[j - i]) * x;
      }
      cost += 1LL * (num * j - sum) * y;
      if (j >= 1000000) break;
    }
    if (cost < ans) ans = cost;
  }
  printf("%lld\n", ans);
}
