#K47892. Minimum Edges for a General Graph

    ID: 28299 Type: Default 1000ms 256MiB

Minimum Edges for a General Graph

Minimum Edges for a General Graph

You are given a star tree with \( n \) nodes, which initially has \( n-1 \) edges. After that, \( k \) additional edges are added to the tree. Your task is to compute the minimum number of edges in the resulting connected graph.

The answer is given by the formula:

\( \text{edges} = (n - 1) + k \)

Note: The input consists of multiple test cases. For each test case, output the result on a new line.

inputFormat

The first line contains an integer \( T \) denoting the number of test cases.

Each of the following \( T \) lines contains two space-separated integers \( n \) and \( k \) which represent the number of nodes in the star tree and the number of additional edges, respectively.

outputFormat

For each test case, output a single integer that represents the minimum number of edges required in the connected graph.

## sample
3
4 2
5 1
3 0
5

5 2

</p>