#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, y;
  cin >> n >> x >> y;
  long long p = x / y;
  if (x % y == 0) p--;
  vector<long long> cnt(2 * 1000007);
  vector<long long> sum(2 * 1000007);
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    cnt[temp]++;
    sum[temp] += temp;
  }
  for (int i = 1; i < 2 * 1000007; i++) {
    cnt[i] += cnt[i - 1];
    sum[i] += sum[i - 1];
  }
  long long mincost = LLONG_MAX;
  for (long long i = 2; i <= 1000007 - 7; i++) {
    long long cost = 0;
    for (long long j = i; j < 2 * 1000007; j += i) {
      long long k = max(j - p, j - i + 1);
      cost += (j * (cnt[j] - cnt[k - 1]) - (sum[j] - sum[k - 1])) * y;
      cost += (cnt[k - 1] - cnt[j - i]) * x;
      if (cost > mincost) break;
    }
    mincost = min(cost, mincost);
  }
  cout << mincost << endl;
}
