mod = 998244353 def main(): import sys input = sys.stdin.readline def PrimeDecomposition(N): ret = {} n = int(N ** 0.5) for d in range(2, n + 1): while N % d == 0: if d not in ret: ret[d] = 1 else: ret[d] += 1 N //= d if N == 1: break if N != 1: ret[N] = 1 return ret N, M, A, B = map(int, input().split()) C = list(map(int, input().split())) P = PrimeDecomposition(N) div_list = [1] for p in P: e = P[p] div_list_new = [] p_list = [p ** i for i in range(e + 1)] for d in div_list: for pp in p_list: div_list_new.append(d * pp) div_list = div_list_new div_list.sort(reverse=True) L = len(div_list) ok_min = [10 ** 10] * L for i in range(L): di = div_list[i] for c in C: if c % di == 0: ok_min[i] = min(ok_min[i], c) dp = [float("inf")] * L dp[0] = 0 for i in range(L): di = div_list[i] for j in range(i+1, L): dj = div_list[j] if di % dj: continue if di >= ok_min[j]: continue dp[j] = min(dp[j], dp[i] + B + A * (di // dj - 1)) if dp[-1] < 10 ** 18: print(dp[-1] - B) else: print(-1) # print(dp, div_list) if __name__ == '__main__': main()