#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
long long num[N], a[N];
int main() {
  int maxx = 0;
  int n;
  long long X, Y;
  cin >> n >> X >> Y;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    num[x]++;
    maxx = max(maxx, x);
  }
  for (int i = 1; i < N; i++) {
    a[i] = num[i] * i + a[i - 1];
    num[i] = num[i] + num[i - 1];
  }
  long long ans = X * n;
  for (int d = 2; d <= 1000000; d++) {
    long long now = 0;
    for (int k = 0; k * d < maxx; k++) {
      int L = max((long long)k * d, (k + 1) * d - (X / Y) - 1);
      long long gs = (num[(k + 1) * d - 1] - num[L]);
      long long gs2 = (num[(k + 1) * d - 1] - num[k * d]);
      now += (long long)(gs * (k + 1) * d - (a[(k + 1) * d - 1] - a[L])) * Y;
      now += (long long)(gs2 - gs) * X;
    }
    if (now < ans) {
      ans = now;
    }
  }
  cout << ans;
  return 0;
}
