#include <bits/stdc++.h>
using namespace std;
int mob[2000005], vis[2000005], p[1000005];
long long cnt[2000005], cnt2[2000005], pnum;
bool prime[1000005];
long long mod = 1e9 + 7;
int read() {
  char c;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    ;
  int x = c - 48;
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  return x;
}
void Mobius() {
  int i, j;
  pnum = 0;
  memset(prime, true, sizeof(prime));
  mob[1] = 1;
  for (i = 2; i < 1000005; i++) {
    if (prime[i]) {
      p[pnum++] = i;
      mob[i] = -1;
    }
    for (j = 0; j < pnum && (long long)i * p[j] < 1000005; j++) {
      prime[i * p[j]] = false;
      if (i % p[j] == 0) {
        mob[i * p[j]] = 0;
        break;
      }
      mob[i * p[j]] = -mob[i];
    }
  }
}
int main(void) {
  int n, m, x, T, MAX, ca = 1;
  long long ans, temp, k, kk, nnn, res, i, j;
  Mobius();
  n = read();
  k = read();
  kk = read();
  nnn = k / kk;
  memset(cnt, 0, sizeof(cnt));
  memset(cnt2, 0, sizeof(cnt2));
  MAX = 1;
  for (i = 1; i <= n; i++) {
    x = read();
    cnt[x]++;
    cnt2[x] += x;
    MAX = max(MAX, x);
  }
  for (int i = 1; i <= 2000000; i++) {
    cnt[i] += cnt[i - 1];
    cnt2[i] += cnt2[i - 1];
  }
  ans = -1;
  T = 0;
  for (i = p[T]; T < pnum; i = p[T]) {
    T++;
    res = 0;
    for (j = i; j <= 1000000 + i; j += i) {
      if (nnn >= i) {
        res += (((cnt[j - 1] - cnt[j - i]) * j) - (cnt2[j - 1] - cnt2[j - i])) *
               kk;
      } else {
        res += (cnt[j - nnn - 1] - cnt[j - i]) * k;
        res += (((cnt[j - 1] - cnt[j - nnn - 1]) * j) -
                (cnt2[j - 1] - cnt2[j - nnn - 1])) *
               kk;
      }
    }
    if (ans == -1) ans = res;
    ans = min(ans, res);
  }
  printf("%I64d\n", ans);
}
