def ceil_div(x, y): ret = x // y if x % y == 0: return ret else: return ret + 1; def calc(n, k, x, y, av, ycnt): ret = y * ycnt for e in av: rest = e - k * ycnt if rest <= 0: continue ret += x * ceil_div(rest, k) return ret tmp = tuple(list(map(int, input().split(' ')))) a = list(map(int, input().split(' '))) av = [ e - 1 for e in a ] n, k, x, y = tmp x0 = 0 x3 = int(1e18) f = lambda arg: calc(n, k, x, y, av, arg) while 2 < x3 - x0: x1 = (2 * x0 + x3) // 3 x2 = (x0 + 2 * x3) // 3 f1 = f(x1) f2 = f(x2) if f1 < f2: x3 = x2 else: x0 = x1 print(min([f(x0), f(x0+1), f(x0+2)]))