#include <bits/stdc++.h>
using namespace std;
int n, ar[500010], dm[1000010];
long long dx, dy, sm[1000010];
int _dm(int l, int r) { return dm[r] - dm[l - 1]; };
long long _sm(int l, int r, int i) {
  return (long long)i * _dm(l, r) - (sm[r] - sm[l - 1]);
};
long long _cl(int x) {
  int i = x, a;
  long long rs = 0;
  for (;; i += x) {
    a = (dy * i - dx) / dy;
    ++a;
    if (a <= 1000000) rs += dy * _sm(max(a, i - x + 1), min(i, 1000000), i);
    if (a - 1 > i - x) rs += dx * _dm(i - x + 1, min(a - 1, 1000000));
    if (i >= 1000000) break;
  }
  return rs;
};
void cl() {
  int i, j, k, d, t;
  scanf("%d %I64d %I64d", &n, &dx, &dy);
  for (i = 0; i < n; ++i) scanf("%d", &ar[i]);
  for (i = 0; i < n; ++i) dm[ar[i]]++, sm[ar[i]] += ar[i];
  for (i = 1; i <= 1000000; ++i) dm[i] += dm[i - 1], sm[i] += sm[i - 1];
  long long rs = LLONG_MAX;
  for (i = 2; i <= 1000000; ++i) rs = min(rs, _cl(i));
  printf("%I64d\n", rs);
};
int main() {
  cl();
  return 0;
};
