from heapq import heappush, heappop import sys input = sys.stdin.readline def divisor(n): divisors = [] i = 1 while i * i < n: if n % i == 0: divisors.append(i) divisors.append(n // i) i += 1 if i * i == n: divisors.append(i) divisors.sort() return divisors N, M, A, B = map(int, input().split()) C = list(map(int, input().split())) C.sort() div = divisor(N) leastmultiple = {} for d in div: for c in C: if c % d == 0: leastmultiple[d] = c break dist = {} heap = [(0, N)] dist[N] = 0 while heap: d, n = heappop(heap) if n == 1: print(d-B) exit() if dist[n] < d: continue for m in div: if m >= n: break if m in leastmultiple and leastmultiple[m] < n: continue nd = d + (n//m-1) * A + B if m not in dist or nd < dist[m]: dist[m] = nd heappush(heap, (nd, m)) print(-1)