Nikit's Problem
Submissions: 474   Accuracy:

19.41%

  Difficulty: Easy   Marks: 2

Nikit has to give a short contest of duration "N" minutes. The contest is divided into 2 sections-Easy and Hard. X and Y marks will be awarded per problem for Easy and Hard respectively. Assume that he will take P minutes to solve an Easy problem and Q minutes to solve a Hard problem successfully.

There are A and B number of Easy Hard problems respectively. Calculate how many problems of a particular section should he perform to get the maximum score in time.

Note: Assume he will always try to solve the easiest problem.

Input:

The first line of input contains an integer T denoting the number of test cases. T-test cases follow.

  • The first line of each test case contains N.
  • The second line of each test case contains two space-separated integers X and Y denoting marks of a problem.
  • The third line of each test case contains two space-separated integers A and B denoting the number of problems of each section.
  • The fourth line of each test case contains two space-separated integers P and Q denoting minutes to solve a problem.

Output:

For each test case, print number of Easy and Hard problems should be solved by Nikit.


Constraints:

1 ≤ T ≤ 10

10 ≤ N ≤ 1000

1 ≤ X < Y ≤ 100

1 ≤ A, B ≤ 100

1 ≤ P < Q ≤ N


Example:

Input:

2
180

2 5
4 6
20 40

50
5 10
5 3
10 20

Output:

Easy 1
Hard 4
Easy 5
Hard 0

Explanation:

Case 1: Maximum marks get scored when he solves 1 easy and 4 hard problems.

Case 2: Maximum marks gets scored when he solves 5 easy problems or 1 easy and 2 hard problems or 3 easy and 1 hard problem. But he always try to solve the easiest problem therefore solves 5 easy problems.

** For More Input/Output Examples Use 'Expected Output' option **

Author: kartikeyagoswami20


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.