You are attempting a test in which there is no punishment for wrong submissions and time constraints. There can be many numbers of participants on the same rank. The candidates who have the same score are on the same rank. The next rank is determined on the basis of the number of candidates who have secured the previous rank.
You are given the last rank and number of candidates who have secured the last rank. For example, if there are five candidates in the contest and their respective scores are \(100\), \(100\), \(90\), \(90\), and \(80\). The ranks of these candidates are \(1\), \(1\), \(3\), \(3\), and \(5\) respectively. You know \(5\) and \(1\) that is the last rank and the number of participants who have secured the last rank. You are required to determine the total number of participants in the contest.
Input format
- First line: A single integer \(Q\) denoting the number of queries
- Next \(Q\) Lines: Two integers \(L\) and \(C\) denoting the last rank in the contest and number of participants who have secured the last rank
Output format
For each query, print an integer \(N\) denoting the total number of contestants in the contest.
Constraints
\(1 \le Q \le 10^5\\ 1 \le L\le 10^{12}\\ 1 \le C\le10^{12}\)