#include <bits/stdc++.h>
using namespace std;
long long cnt[2001005];
long long ind_sum[2001005];
long long x, y;
long long total_calc(long long l, long long r) {
  long long nowl = max(l, r - x / y), ret;
  ret = (r * (cnt[r] - cnt[nowl - 1]) - (ind_sum[r] - ind_sum[nowl - 1])) * y;
  if (nowl > l) ret += (cnt[nowl - 1] - cnt[l - 1]) * x;
  return ret;
}
int vis[2001005];
int main() {
  int i, n;
  scanf("%d", &n);
  cin >> x >> y;
  for (i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
    ind_sum[x] += x;
  }
  for (i = 1; i < 2001005; i++) {
    cnt[i] += cnt[i - 1];
    ind_sum[i] += ind_sum[i - 1];
  }
  long long ans = (long long)n * x;
  for (i = 2; i < 2001005; i++) {
    if (vis[i]) continue;
    long long tmp = total_calc(1, i);
    for (int j = i + i; j < 2001005; j += i) {
      vis[j] = 1;
      tmp += total_calc(j - i + 1, j);
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}
