Kill the Monster solution codeforces- Monocarp is playing a computer game. In this game, his character fights different monsters. A fight between a character and a monster goes as follows. Suppose the character initially has health hChC and attack dCdC; the monster initially has health hMhM and attack dMdM. The fight consists of several steps: the character attacks the monster, decreasing the monster’s health by dCdC; the monster attacks the character, decreasing the character’s health by dMdM; the character attacks the monster, decreasing the monster’s health by dCdC; the monster attacks the character, decreasing the character’s health by dMdM; and so on, until the end of the fight. The fight ends when someone’s health becomes non-positive (i. e. 00 or less). If the monster’s health becomes non-positive, the character wins, otherwise the monster wins. Kill the Monster solution codeforces

Kill the Monster solution codeforces

Monocarp is playing a computer game. In this game, his character fights different monsters.

A fight between a character and a monster goes as follows. Suppose the character initially has health hChC and attack dCdC; the monster initially has health hMhM and attack dMdM. The fight consists of several steps:

  1. the character attacks the monster, decreasing the monster’s health by dCdC;
  2. the monster attacks the character, decreasing the character’s health by dMdM;
  3. the character attacks the monster, decreasing the monster’s health by dCdC;
  4. the monster attacks the character, decreasing the character’s health by dMdM;
  5. and so on, until the end of the fight.

The fight ends when someone’s health becomes non-positive (i. e. 00 or less). If the monster’s health becomes non-positive, the character wins, otherwise the monster wins. Kill the Monster solution codeforces

Monocarp’s character currently has health equal to hChC and attack equal to dCdC. He wants to slay a monster with health equal to hMhM and attack equal to dMdM. Before the fight, Monocarp can spend up to kk coins to upgrade his character’s weapon and/or armor; each upgrade costs exactly one coin, each weapon upgrade increases the character’s attack by ww, and each armor upgrade increases the character’s health by aa.

Can Monocarp’s character slay the monster if Monocarp spends coins on upgrades optimally?

Input

The first line contains one integer tt (1t51041≤t≤5⋅104) — the number of test cases. Each test case consists of three lines:

The first line contains two integers hChC and dCdC (1hC10151≤hC≤10151dC1091≤dC≤109) — the character’s health and attack;

The second line contains two integers hMhM and dMdM (1hM10151≤hM≤10151dM1091≤dM≤109) — the monster’s health and attack;

The third line contains three integers kkww and aa (0k21050≤k≤2⋅1050w1040≤w≤1040a10100≤a≤1010) — the maximum number of coins that Monocarp can spend, the amount added to the character’s attack with each weapon upgrade, and the amount added to the character’s health with each armor upgrade, respectively.

The sum of kk over all test cases does not exceed 21052⋅105.

Output Kill the Monster solution codeforces

For each test case,  Kill the Monster solution codeforcesprint YES if it is possible to slay the monster by optimally choosing the upgrades. Otherwise, print NO.

Example

input

Copy
4
25 4
9 20
1 1 10
25 4
12 20
1 1 10
100 1
45 2
0 4 10
9 2
69 2
4 2 7

output

Copy
YES
NO
YES
YES
Note Kill the Monster solution codeforces

In the first example, Polycarp can spend one coin to upgrade weapon (damage will be equal to 55), then health during battle will change as follows: (hC,hM)=(25,9)(25,4)(5,4)(5,1)(hC,hM)=(25,9)→(25,4)→(5,4)→(5,−1). The battle ended with Polycarp’s victory.

In the second example, Polycarp has no way to defeat the monster.

In the third example, Polycarp has no coins, so he can’t buy upgrades. However, the initial characteristics are enough for Polycarp to win.

In the fourth example, Polycarp has 44 coins. To defeat the monster, he has to spend 22 coins to upgrade weapon and 22 coins to upgrade armor.

Leave a Comment

Your email address will not be published.