#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 7;
const int INF = 0x7fffffff;
long long c[maxn], s[maxn];
long long a[maxn], num[maxn];
int main() {
  long long n, x, y;
  while (cin >> n >> x >> y) {
    long long ans = n * x;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      num[a[i]]++;
    }
    c[0] = s[0] = 0;
    for (int i = 1; i <= 2e6; i++) {
      c[i] = c[i - 1] + num[i];
      s[i] = s[i - 1] + i * num[i];
    }
    long long p = (x + y - 1) / y;
    for (int i = 2; i <= 1e6; i++) {
      long long cur = 0;
      for (int j = i; j <= 1e6 + i && cur < ans; j += i) {
        int l = j - i, r = j;
        int k = r - p;
        k = max(k, l);
        long long temp = (c[r] - c[k]) * j - (s[r] - s[k]);
        cur += temp * y;
        cur += (c[k] - c[l]) * x;
      }
      ans = min(ans, cur);
    }
    cout << ans << endl;
  }
  return 0;
}
