#include <bits/stdc++.h>
using namespace std;
int a[2000009], p[2000009], f[2000009];
long long int sum[2000009] = {0};
int main() {
  int n, x, y, count = 0;
  cin >> n >> x >> y;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]] += 1;
    sum[a[i]] += a[i];
  }
  for (int i = 1; i < 2000009; i++) f[i] += f[i - 1], sum[i] += sum[i - 1];
  long long int sol = 1e18, coun1 = 0, coun2 = 0, s = 0, ch = 0;
  int di = x / y;
  for (int i = 2; i < 2000009; i++) {
    long long int cur = 0;
    if (!p[i]) {
      int l = 0, r = 0;
      for (int j = i; j < 2000009; j += i) {
        p[j] = 1;
        r = j;
        l = j - i;
        coun1 = f[r - 1] - f[max(l, r - di - 1)];
        s = sum[r - 1] - sum[max(l, r - di - 1)];
        coun2 = f[r - 1] - f[l] - (f[r - 1] - f[max(l, r - di - 1)]);
        cur += (coun1 * 1ll * j - s) * 1ll * y + coun2 * 1ll * x;
        if (cur < 0) {
          cur = 1e18;
          break;
        }
      }
      sol = min(sol, cur);
    }
  }
  cout << sol << endl;
}
