406900: GYM102606 G Geralt of Rivia
Description
The master witcher Geralt of Rivia is going to hunt Cuber QQ, who is a notorious monster in Jungle-Brain. Geralt's attack value is denoted by an integer $$$a_g$$$, and his defense value is denoted by an integer $$$d_g$$$. Similarily, Cuber QQ's attack value and defense values are denoted by two integer $$$a_c$$$, $$$d_c$$$. Meanwhile, the initial Health Point (HP) of Cuber QQ is an integer $$$n$$$, and Geralt has infinite amount of HP, because he can drink potions to recover from damage.
The damage of an attack will be reduced by the receiver's defense value, i.e., if the attack value is $$$a$$$ and the opponent's defense value is $$$d$$$, the actual damage caused is $$$\max(0, a-d)$$$. The combat will go as follows. Geralt and Cuber QQ take turns to attack. Assuming currently Cuber QQ's HP is $$$hp$$$. Geralt will attack first, and Cuber QQ will receive a damage of $$$\max(0, a_g - d_c)$$$. and its HP would be $$$hp - \max(0, a_g - d_c)$$$. Once Cuber QQ's HP reaches zero or less, he will be dead and Geralt wins the combat, otherwise Cuber QQ will fight back, causing damage $$$\max(0, a_c - d_g)$$$.
Geralt can pay crowns (some kind of money used in Jungle-Brain, to upgrade his attack value and defense value. He can pay $$$a$$$ crowns to increase his attack value by 1, and increase his defense value by $$$1$$$ at the cost of $$$b$$$ crowns. However, he only has $$$m$$$ crowns so the total number of crowns he pays must be no more than $$$m$$$. Note that he can add any rational number of attack and defense, e.g., he can pay $$$\frac{3a}{5}$$$ crowns to increase $$$\frac{3}{5}$$$ attack.
Geralt wants to minimize the damage he receives. Please tell him the minimal damage he shall receive if he plans optimally to upgrade. If Geralt can't defeat the monster, output $$$-1$$$ instead.
InputThe first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$), denoting the number of test cases. Then $$$t$$$ test cases follow.
Each case contains two lines.
The first line contains four space-separated integers $$$a_g$$$, $$$d_g$$$, $$$a_c$$$, $$$d_c$$$ ($$$1 \le a_g, d_g, a_c, d_c \le 10^4$$$), denoting the attack value and the defense value of Geralt and Cuber QQ respectively.
The second line contains another four space-separated integers $$$n$$$, $$$m$$$, $$$a$$$, $$$b$$$ ($$$1 \le n, m, a, b \le 10^4$$$) denoting Cuber QQ's initial HP, the amount of crowns Geralt has, the unit cost of attack upgrade and the unit cost of defense upgrade.
OutputFor each case, output the answer in the form of a completely reduced fraction "$$$x/y$$$", where $$$x$$$ and $$$y$$$ are relatively prime integers in a line denoting the minimal amount of damage Geralt will receive from Cuber QQ or $$$-1$$$ if Geralt cannot win at all.
ExampleInput3 1 1 2 2 1 1 1 1 2 2 1 1 1 1 1 1 6 6 66 66 66 666 6 666Output
-1 0/1 2214/37