N, K, X, Y = gets.split.map(&:to_i) A = gets.split.map { |a| a.to_i - 1 }.sort C = A.map { |a| a / K + (a % K == 0 ? 0 : 1) } if X >= Y puts C.max exit end if N * X <= Y puts C.map { |c| c * X }.sum exit end ok = Y / X bhm_cnt = ok == N ? 0 : C[N - ok - 1] bh_cnt = C[N - ok..].map { |c| c - bhm_cnt }.sum # p [:bh_cnt, bh_cnt, :bhm_cnt, bhm_cnt] puts X * bh_cnt + Y * bhm_cnt