#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n, x, y;
int ara[N + 5];
long long COUNTER[N + 5];
long long cnt[N + 5];
long long sum[N + 5];
int main() {
  scanf("%d %d %d", &n, &x, &y);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ara[i]);
    COUNTER[ara[i]]++;
  }
  for (int i = 1; i <= N; i++) cnt[i] = cnt[i - 1] + COUNTER[i];
  for (int i = 1; i <= N; i++) sum[i] = sum[i - 1] + COUNTER[i] * (long long)i;
  long long c = x / y;
  long long answer = 1e18;
  for (long long g = 2; g <= N; g++) {
    long long cost = 0;
    for (long long i = g; i <= N; i += g) {
      long long pre = max(i - g, i - c - 1);
      long long other = (cnt[pre] - cnt[i - g]) * x;
      long long s = y * ((cnt[i] - cnt[pre]) * i - (sum[i] - sum[pre]));
      cost += other + s;
      if (cost > answer) break;
    }
    answer = min(answer, cost);
  }
  cout << answer;
}
