Bhanu Bhai and his friends bought a giant subway of length "n". Bhanu is assigned a duty of cutting the sub in as many pieces as possible. But his friends gave him condition that each piece should be either of length x, y or z. Since Bhanu is busy eating a pizza, he assigns you a task to maximise number of pieces.
Input
- First line contains T, number of test cases.
- First line of each test case contains n, the length of the subway.
- Second line of each test case contains x, y and z respectively.
Output
- Print maximum number of subs into which the entire giant sub can be divided in, on a new line.
Constraints
- 1 <= t <= 70
- 1 <= n, x, y, z <= 4000
2 4 2 1 1 5 5 3 2
4 2
In the first test case, total length is 4, and cut lengths are 2, 1 and 1. We can make maximum 4 subs each of length 1. In the second test case, we can make two subs of lengths 3 and 2.
For more clarity you can type your own custom input and see the expected output.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor