from collections import Counter n, k, x, y = map(int, input().split()) A = list(map(int, input().split())) c = Counter() tot = 0 for a in A: c[(a-2)//k+1] += 1 tot += (a-2)//k+1 ans = tot * x l = sorted(list(c.items())) tmp_key = 0 tmp_val = n for i in range(len(l)): key, val = l[i] tot -= (key-tmp_key) * tmp_val tmp_val -= val tmp_key = key ans = min(ans, tot * x + key * y) print(ans)