#include <bits/stdc++.h>
using namespace std;
const int MAXV = 2e6 + 6;
int n, x, y, a;
int cnt[MAXV];
long long sum[MAXV], sol = 1e18;
int main() {
  scanf("%d%d%d", &n, &x, &y);
  int k = x / y;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    cnt[a]++;
    sum[a] += a;
  }
  for (int i = 1; i < MAXV; ++i) cnt[i] += cnt[i - 1];
  for (int i = 1; i < MAXV; ++i) sum[i] += sum[i - 1];
  for (int i = 2; i < MAXV / 2; ++i) {
    long long curr = 0;
    int d = min(k, i - 1);
    for (int j = i; j < MAXV; j += i) {
      curr += (long long)x * (cnt[j - d - 1] - cnt[j - i]);
      curr += ((long long)j * (cnt[j] - cnt[j - d - 1]) -
               (sum[j] - sum[j - d - 1])) *
              y;
    }
    sol = min(sol, curr);
  }
  printf("%lld\n", sol);
  return 0;
}
