#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 192;
long long s[maxn], c[maxn];
int main() {
  int a, n, x, y, i, j;
  cin >> n >> x >> y;
  int p = x / y;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    c[a]++;
    s[a] += a;
  }
  for (i = 1; i <= 2000000; i++) {
    c[i] += c[i - 1];
  }
  for (i = 1; i <= 2000000; i++) {
    s[i] += s[i - 1];
  }
  long long ans = 1e18;
  long long temp = 0;
  for (i = 2; i <= 1000000; i++) {
    temp = 0;
    for (j = i; j <= 1000000 + i && temp <= ans; j += i) {
      int k = max(j - i + 1, j - p);
      temp += 1ll * ((c[j] - c[k - 1]) * j - (s[j] - s[k - 1])) * y;
      temp += 1ll * (c[k - 1] - c[j - i]) * x;
    }
    ans = min(ans, temp);
  }
  cout << ans << endl;
}
