Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.

Arpa can perform two types of operations:

  * Choose a number and delete it with cost x. 
  * Choose a number and increase it by 1 with cost y. 



Arpa can apply these operations to as many numbers as he wishes, and he is allowed to apply the second operation arbitrarily many times on the same number.

Help Arpa to find the minimum possible cost to make the list good.

Input

First line contains three integers n, x and y (1 ≤ n ≤ 5·105, 1 ≤ x, y ≤ 109) — the number of elements in the list and the integers x and y.

Second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the list.

Output

Print a single integer: the minimum possible cost to make the list good.

Examples

Input

4 23 17
1 17 17 16


Output

40


Input

10 6 2
100 49 71 73 66 96 8 60 41 63


Output

10

Note

In example, number 1 must be deleted (with cost 23) and number 16 must increased by 1 (with cost 17).

A gcd (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd [here](https://en.wikipedia.org/wiki/Greatest_common_divisor).
import java.io.*;
import java.util.*;

public class B850 {

	public static void main(String[] args) throws IOException {
		IO io = new IO(System.in);
		
		int max_a = 1000005;

		ArrayList<Integer> primes = sieve(max_a);

		int n = io.nextInt();
		int x = io.nextInt(); // delete
		int y = io.nextInt(); // increment
		
		long[] count = new long[max_a];
		for (int i = 0; i < n; i++) {
			int a = io.nextInt();
//			int a = 1;
			count[a]++;
		}
		
		long[] cnt = new long[max_a];
		long[] sum = new long[max_a];
		
		for (int i = 1; i < sum.length; i++) {
			cnt[i] = cnt[i-1] + count[i];
			sum[i] = sum[i-1] + (long) i * count[i];
		}
		
		// max amount of increments that is cheaper than 1 delete
		int len = x / y;
		
		
		long best = Long.MAX_VALUE;
		
		for (int p : primes) {
			// use p as gcd
			long cst = 0;
			int total_inc = 0;
			
			for (int cur = p; cur - p < max_a; cur+=p) {
				// Determine numbers better to increment
				// Out of numbers between cur-p+1 and cur
				
				int start = Math.max(cur - p +1, cur-len);
				int end = Math.min(max_a-1, cur);
				
				if (start <= end) {
					// Increment all numbers start, start+1,...,end instead of remove
					long nr = cnt[end]-cnt[start-1];
					// Sum of numbers that are getting increment
					long s = sum[end]-sum[start-1];
					
					total_inc += nr;
					cst += ((long) cur * nr - s)*y;
				}
			}
			
			cst += (n-total_inc) * (long) x;
			best = Math.min(best, cst);
		}


		io.println(best);

		io.close();
	}


	// return ArrayList<Integer> of all primes <= n.
	static ArrayList<Integer> sieve(int n) {
		ArrayList<Integer> res = new ArrayList<Integer>();
		boolean[] notPrime = new boolean[n + 1];
		for (int i = 2; i <= n; i++) {
			if (!notPrime[i]) {
				res.add(i);
				for (int j = 2; j * i <= n; j++) {
					notPrime[i * j] = true;
				}
			}
		}
		return res;
	}

	static class IO extends PrintWriter {
		static BufferedReader r;
		static StringTokenizer t;

		public IO(InputStream i) {
			super(new BufferedOutputStream(System.out));
			r = new BufferedReader(new InputStreamReader(i));
			t = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!t.hasMoreTokens()) {
				t = new StringTokenizer(r.readLine());
			}
			return t.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
	}
}