In complex strategy games, determining the optimal strategy to defeat your opponent is crucial. In this scenario, you are facing an opponent who has numWodT wooden towers and numStoT stone towers. Each tower possesses hpT hit points. You command myUnits soldiers, and each soldier can only attack one type of tower. Your task is to divide your soldiers into two groups: one group will exclusively attack wooden towers, while the other will focus solely on stone towers. Once the game begins, soldiers cannot switch groups (i.e., soldiers assigned to attack wooden towers cannot be reassigned to attack stone towers, and vice versa).
During each round of attacks, the following occurs:
Each soldier in the first group attacks a wooden tower, inflicting point of damage. You can independently select which tower each soldier attacks.
Each soldier in the second group attacks a stone tower, also inflicting point of damage. You can independently select which tower each soldier attacks.
Your opponent retaliates: wooden towers will eliminate · attackT of your soldiers from the first group, where is the number of wooden towers still standing. Similarly, stone towers will eliminate · attackT of your soldiers from the second group, where is the number of stone towers still standing.
Your objective is to calculate the minimum number of rounds needed to destroy all towers. If it is impossible to achieve this, output .
You will receive five numbers: myUnits, hpT, attackT, numWodT, numStoT ( ≤ myUnits ≤ 10^9, ≤ hpT, attackT, numWodT, numStoT ≤ ).
Output the minimum number of rounds required to destroy all towers, or if it is impossible.
Example 1