409649: GYM103660 B Jiubei and Overwatch

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Jiubei and Overwatchtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

It's high noon!

Jiubei loves playing Overwatch even if it is a long time since the last update. Now he is using a damage skill to kill enemies.

The skill will damage all enemies simultaneously and the damage is determined by the time Jiubei charges this skill. The skill has a charging period division number $$$k$$$, and two damage increase numbers $$$x,y$$$. If he charged for $$$t$$$ seconds, the damage is calculated as follows:

  • If $$$t \le k$$$, the damage is $$$t \times x$$$.
  • Otherwise, the damage is $$$k \times x + (t - k) \times y$$$

Jiubei has $$$n$$$ enemies, and the $$$i$$$-th enemy's health is $$$a_i$$$.

Please tell Jiubei how long it takes to charge his skill to kill all of his enemies. Note that the skill can only be used once.

Additionally, an enemy is killed if and only if his health is not greater than the damage he/she take.

Input

The first line contains a single integer $$$T(1 \le T \le 100)$$$ — the number of test cases.

The first line of each test case contains four integers $$$n, k, x, y(1 \le n, k, x, y \le 100)$$$ — the number of enemies, the number of charging period division, the numbers of damage increase respectively.

The second line of each test case contains $$$n$$$ integers $$$a_1, a_2,\dots,a_n(1\le a_i \le 10^9)$$$ — the health of enemies.

Output

For each test case, output a single integer in a line, indicating the minimum time Jiubei needs to charge his skill to kill all enemies.

ExampleInput
2
3 2 4 3
1 2 5
3 2 4 3
1 5 21
Output
2
7

加入题单

上一题 下一题 算法标签: