#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int maxn = 2e6 + 10;
int a[maxn], cnt[maxn];
long long sum[maxn];
int main(void) {
  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), cnt[a[i]]++, sum[a[i]] += a[i];
  for (int i = 1; i <= 2000000; i++) cnt[i] += cnt[i - 1], sum[i] += sum[i - 1];
  long long ans = INF;
  for (int i = 2; i <= 1000000; i++) {
    long long tmp = 0;
    int zz = min(z, i - 1);
    for (int j = 1; (j - 1) * i < 1000000; j++) {
      if (i - zz - 2 >= 0)
        tmp += (long long)(cnt[j * i - zz - 1] - cnt[j * i - i]) * x;
      if (zz)
        tmp += ((long long)i * j * (cnt[j * i - 1] - cnt[j * i - zz - 1]) -
                (sum[j * i - 1] - sum[j * i - zz - 1])) *
               y;
    }
    ans = min(ans, tmp);
  }
  printf("%I64d\n", ans);
  return 0;
}
