You bought a new microwave, and it has a lot of buttons for entering the cooking time quickly. Some buttons add time and some subtract it. You want to enter the cooking time you have in mind with as few button presses as possible.
The cooking time is at least 0 seconds and at most 1 hour. If a button press would make the cooking time less than 0 seconds, the microwave sets the cooking time to 0 seconds. If a button press would make the cooking time more than 1 hour, the microwave sets the cooking time to 1 hour. The cooking time starts at 0 seconds. At least one button always adds 1 second or more.
Given the buttons of the microwave and a desired cooking time, find the smallest number of button presses that reaches that time. If the desired time cannot be entered exactly, find the shortest reachable cooking time that is not below the target, and the smallest number of button presses that reaches it. The cooking time cannot be changed once the microwave starts cooking.
The first line has the number of test cases, a positive integer of at most 100.
Each test case has two lines.
For each test case, print one line with two space-separated integers: the minimum number of button presses needed, and the minimum number of extra seconds that the microwave must run beyond the target.