Ensure that you are logged in and have the required permissions to access the test.
Bob and Alice decided that problem X needs at least N distinct solutions to be written. It does not matter how many solutions each of them will write, they need to write at least N solutions in total.
Bob needs t1 units of time to write a solution, and Alice needs t2 units of time. They start to work simultaneously at time 0. For example, Bob finishes writing his first solution at time t1, his second solution at 2∗t1, and so on.
Bob and Alice are working using the same algorithm. Each time Bob or Alice finishes writing a solution, he checks on how many solutions have already been written up to the current time moment t. If the number of such solutions is strictly less than N, then he starts writing the next solution. If a member began working on a problem, he does not stop working under any circumstances and he will surely finish it.
Bob and Alice realize that if they act on this algorithm, they will not necessarily write exactly N solutions in total.
Considering that Bob and Alice work non-stop, find how many solutions they wrote in total and the moment when the latest solution was finished.
Input format
Output format
For each test case, print two integers m and f, where m is the number of written solutions and f is the moment when the last solution was finished. Output for each test case should be in a new line.
Constraints
1≤T≤1000001≤N,t1,t2≤1000000000
For the first test case, Bob will finish writing his first solution at t=1. At this moment, only 1 solution is completed. Therefore, he will start writing his second solution and finish at t=2. At this moment, Alice will also finish writing her first solution. Thus, total 3 solutions will be written.
For the third test case, both Bob and Alice will end up writing exactly 4 solutions at t=10.