#include <bits/stdc++.h>
using namespace std;
int n, A, B, a[2000009];
long long s[2000009];
int main() {
  scanf("%d%d%d", &n, &A, &B);
  int i, j, k, p = A / B;
  for (i = 1; i <= n; i++) {
    scanf("%d", &j);
    a[j]++;
    s[j] += j;
  }
  for (i = 1; i <= 2000000; i++) {
    a[i] += a[i - 1];
    s[i] += s[i - 1];
  }
  long long ans = (long long)n * A;
  for (i = 2; i <= 1000000; i++) {
    long long tmp = 0;
    for (j = i; j <= 1000000 + i && tmp < ans; j += i) {
      k = max(j - i + 1, j - p);
      tmp += ((long long)(a[j] - a[k - 1]) * j - (s[j] - s[k - 1])) * B;
      tmp += (long long)(a[k - 1] - a[j - i]) * A;
    }
    ans = min(ans, tmp);
  }
  printf("%lld\n", ans);
  return 0;
}
