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).
/*
 * Author Ayub Subhaniya
 * Institute DA-IICT
 */

import java.io.*;
import java.math.*;
import java.util.*;

public class Codeforces429D
{
	
	InputStream in;
	PrintWriter out;
	
	int MAX=(int)1e6+7;
	void solve() 
	{
		//MAX=25;
		seive(MAX);
		int n=ni();
		long x=nl();
		long y=nl();
		int a[]=new int[MAX];
		int arr[]=new int[n+1];
		for (int i=1;i<=n;i++)
			arr[i]=ni();
		for (int i=1;i<=n;i++)
			a[arr[i]]++;
		
		for (int i=1;i<MAX;i++)
			a[i]+=a[i-1];
		
		Arrays.sort(arr);
		int minidx[]=new int[MAX];
		int maxidx[]=new int[MAX];
		Arrays.fill(minidx, Integer.MAX_VALUE);
		Arrays.fill(maxidx, Integer.MIN_VALUE);
		
		for (int i=1;i<=n;i++)
		{
			maxidx[arr[i]]=Math.max(maxidx[arr[i]], i);
			minidx[arr[i]]=Math.min(minidx[arr[i]], i);
		}
		
		for (int i=1,j=MAX-2;i<MAX;i++,j--)
		{
			minidx[j]=Math.min(minidx[j+1], minidx[j]);
			maxidx[i]=Math.max(maxidx[i-1], maxidx[i]);
		}
		
		long psum[]=new long[n+1];
		for (int i=1;i<=n;i++)
			psum[i]=(long)arr[i]+psum[i-1];
		
		long mincost=Long.MAX_VALUE;
		for (long p:pr)
		{
			//tr(p+" "+mincost+"#################");
			long lcost=0;
			for (long k=0;k*p<MAX-1;k++)
			{
				//tr(k+" ****************");
				int s=(int) (k*p+1);
				int e=(int) Math.min(MAX-1,(k+1)*p-1);
				int l=minidx[s];
				int r=maxidx[e];
				int low=l;
				if (l>r)
					continue;
				//tr(s+" "+e);
				//tr(l+" "+r);
				int result=l-1;
				while (l<=r)
				{
					int mid=(l+r)/2;
					long cost=(p*(k+1)-((long)arr[mid]))*y;
					if (cost>=x)
					{
						result=mid;
						l=mid+1;
					}
					else
						r=mid-1;
				}
				lcost+=((long)(result-low+1))*x+(p*(k+1) *(a[e]-a[arr[result]])-(psum[maxidx[e]]-psum[result]))*y;
				//tr(result+" "+lcost+" "+((a[e]-a[arr[result]]))+" "+(psum[maxidx[e]]-psum[result]));
			}
			
			mincost=Math.min(mincost, lcost);
		}
		out.println(mincost);
	}
	
	ArrayList<Long> pr=new ArrayList<>();
	void seive(int MAX) {
		boolean prime[] = new boolean[MAX + 1];
		Arrays.fill(prime, true);
		for (int i = 2; i * i <= MAX; i++) {
			if (prime[i]) {
				for (int j = 2 * i; j <= MAX; j += i) {
					prime[j] = false;
				}
			}
		}
		for (int i=2;i<=MAX;i++)
			if (prime[i])pr.add((long)i);
	}
	
	
	void run() throws Exception 
	{
		String INPUT = "C:/Users/ayubs/Desktop/input.txt";
		in = oj ? System.in : new FileInputStream(INPUT);
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
		
	}
	public static void main(String[] args) throws Exception 
	{
		new Codeforces429D().run();
	}
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte() 
	{
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) 
		{
			ptrbuf = 0;
			try 
			{
				lenbuf = in.read(inbuf);
			}
			catch (IOException e) 
			{
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean inSpaceChar(int c) 
	{
		return !(c >= 33 && c <= 126);
	}
	
	private int skip() 
	{
		int b;
		while ((b = readByte()) != -1 && inSpaceChar(b))
			;
		return b;
	}
	
	private double nd() 
	{
		return Double.parseDouble(ns());
	}
	
	private char nc() 
	{
		return (char) skip();
	}
	
	private String ns() 
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(inSpaceChar(b))) 
		{ // when nextLine, (inSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n) 
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(inSpaceChar(b))) 
		{
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m) 
	{
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n) 
	{
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	
	private int ni() 
	{
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') 
		{
			minus = true;
			b = readByte();
		}
		
		while (true) 
		{
			if (b >= '0' && b <= '9') 
			{
				num = num * 10 + (b - '0');
			} 
			else 
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl() 
	{
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') 
		{
			minus = true;
			b = readByte();
		}
		
		while (true) 
		{
			if (b >= '0' && b <= '9') 
			{
				num = num * 10 + (b - '0');
			}
			else 
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	
	private void tr(Object... o) 
	{
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
	
}