# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# How Many Kids Are in the Circle?

By deshchow.00 · Limits 1s, 512 MB

A group of kids are standing in a circle and playing catch the ball. For fair play, they always maintain equal distance from one another. Now if the Nth kid is standing right opposite to the Mth kid, how many kids are there in the circle?

## Input

The first line of the input contains a single integer T (1 ≤ T ≤ 20), denoting the number of test cases. Then T test cases follows.

Each test case contains two integers N and M (1 ≤ N < M ≤ 109) respectively.

## Output

Output a single line for each test case, the number of kids in the circle.

## Sample

InputOutput
3
1 3
2 5
4 11


4
6
14


### Statistics

83% Solution Ratio

shojib_muEarliest, Jul '19

shojib_muFastest, 0.0s

shojib_muLightest, 0 B

bokaifShortest, 66B

### Related Contests

 Intra Metropolitan University Junior Programming Contest Summer 2019 Jul '19 AUST CSE 44th Batch Practise Contest 06 May '20 Fun Contest Jul '19