#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2e6;
const long long Inf = 1e18;
int n, x, y, a[Maxn + 1], maxa, size_r;
long long sum[Maxn + 1], sumi[Maxn + 1];
int main(void) {
  scanf("%d%d%d", &n, &x, &y);
  size_r = x / y;
  for (int i = 0; i < n; ++i) {
    int b;
    scanf("%d", &b);
    maxa = max(maxa, b);
    ++a[b];
  }
  for (int i = 1; i <= Maxn; ++i) {
    sum[i] = sum[i - 1] + a[i];
    sumi[i] = sumi[i - 1] + a[i] * (long long)i;
  }
  long long ans = n * (long long)min(x, y);
  for (int p = 2; p <= maxa; ++p) {
    long long cur_ans = 0;
    for (int l = 1; l <= maxa; l += p) {
      int r = l + p - 1;
      int mid = max(l, r - size_r);
      cur_ans += (sum[mid - 1] - sum[l - 1]) * x;
      if (cur_ans >= Inf) {
        cur_ans = Inf;
        break;
      }
      long long tmp =
          (sum[r - 1] - sum[mid - 1]) * r - (sumi[r - 1] - sumi[mid - 1]);
      if (tmp > n) {
        cur_ans = Inf;
        break;
      }
      cur_ans += tmp * y;
      if (cur_ans >= Inf) {
        cur_ans = Inf;
        break;
      }
    }
    ans = min(ans, cur_ans);
  }
  cout << ans << endl;
  return 0;
}
