#include <bits/stdc++.h>
using namespace std;
long long c[2000010];
long long sum[2000010];
int main() {
  int n, x, y;
  while (cin >> n >> x >> y) {
    memset(c, 0, sizeof c);
    memset(sum, 0, sizeof sum);
    for (int i = 1; i <= n; i++) {
      int w;
      scanf("%d", &w);
      c[w]++;
      sum[w] += w;
    }
    for (int i = 0; i <= 2000000; i++) {
      c[i] += c[i - 1];
      sum[i] += sum[i - 1];
    }
    long long ans = 1LL * n * x;
    for (int i = 2; i <= 1000000; i++) {
      long long tmp = 0;
      for (int j = i; j <= 1000000 + i && tmp < ans; j += i) {
        int k = max(j - i, j - ((x - 1) / y + 1));
        long long h = y * ((c[j] - c[k]) * j - (sum[j] - sum[k]));
        h += (c[k] - c[j - i]) * x;
        tmp += h;
      }
      ans = min(ans, tmp);
    }
    cout << ans << endl;
  }
  return 0;
}
