#include <bits/stdc++.h>
using namespace std;
istream& in = cin;
long long n, x, y;
long long data[((int)1e6 + 10)];
long long cnt[((int)1e6 + 10)], sum[((int)1e6 + 10)];
void input() {
  in >> n >> x >> y;
  for (int i = 1; i <= n; ++i) {
    in >> data[i];
    cnt[data[i]]++;
    sum[data[i]] += data[i];
  }
}
void getInput() {}
int main() {
  int TEST_CASE = 1;
  while (TEST_CASE-- > 0) {
    input();
    for (int i = 1; i < ((int)1e6 + 10); ++i) {
      cnt[i] += cnt[i - 1];
      sum[i] += sum[i - 1];
    }
    long long ans = (long long)1e18;
    for (int g = 2; g < ((int)1e6 + 10); ++g) {
      long long div = x / y;
      if (x % y != 0) div++;
      long long tmp = 0;
      if (g == 669707) {
        int t = 0;
      }
      for (int k = 1;; ++k) {
        long long en = (long long)k * g;
        long long st = en - g + 1;
        if (en >= ((int)1e6 + 10)) en = ((int)1e6 + 10) - 1;
        if (st > (int)1e6 || st > en) break;
        long long mid = en - div;
        if (mid < st) {
          mid = st - 1;
        } else {
          tmp += x * (cnt[mid] - cnt[st - 1]);
        }
        long long a = (cnt[en] - cnt[mid]) * en;
        long long b = (sum[en] - sum[mid]);
        long long c = a - b;
        tmp += ((cnt[en] - cnt[mid]) * (k * g) - (sum[en] - sum[mid])) * y;
      }
      ans = min(ans, tmp);
    }
    cout << ans << endl;
  }
  return 0;
}
