#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int mod = 1e9 + 7;
const int N = 2e6 + 9;
const int M = 1e6;
const int kokn = 650;
const int logN = 26;
long long n, x, y, a[N + 5], h[N + 5], h2[N + 5], ans = linf;
int main() {
  scanf("%lld %lld %lld", &n, &x, &y);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    h[a[i]]++;
    h2[a[i]] += a[i];
  }
  for (int i = 1; i < N; i++) {
    h[i] += h[i - 1];
    h2[i] += h2[i - 1];
  }
  for (int i = 2; i <= M; i++) {
    long long res1 = 0;
    long long res2 = 0;
    for (int j = i; j <= M + i; j += i) {
      if (x / y >= i - 1)
        res1 += (h[j - 1] - h[j - i]) * (long long)j - (h2[j - 1] - h2[j - i]);
      else {
        res2 += h[j - x / y - 1] - h[j - i];
        res1 += (h[j - 1] - h[j - x / y - 1]) * (long long)j -
                (h2[j - 1] - h2[j - x / y - 1]);
      }
    }
    ans = min(ans, x * res2 + y * res1);
  }
  printf("%lld\n", ans);
  return 0;
}
