CF2158A.Suspension

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Suspension

A game is being played which initially consists of nn players. On fouls, the referee is allowed to award yellow and red cards. The total number of yellow cards yy and red cards rr awarded to players is known for the game.

There are 22 ways a player can be suspended:

  • Receiving a red card.
  • Receiving 22 yellow cards.

Once a player is suspended, they are removed from the game and can't receive any more cards. Determine the maximum number of players suspended from the game possible.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5001 \le t \le 500). The description of the test cases follows.

The first line of each test case contains an integer nn (1n1001 \le n \le 100).

The second line of each test case contains two integers yy and rr (0rn0 \le r \le n, 0y+r2n0 \le y + r \le 2n).

Output

For each test case, print one line containing a single integer — denoting the maximum number of players suspended from the game possible.

Note

For the first test case:

  • One of the possible ways to achieve maximum: Player 22 receives a red card, Player 33 receives a yellow card followed by a red card.
  • This way Player 22 and 33 are suspended.

For the second test case:

  • No cards are awarded at all, so no one is suspended.

For the third test case:

  • One of the possible ways to achieve maximum: Player 11 receives 22 yellow cards, Player 22 receives 22 yellow cards, and Player 44 receives 22 yellow cards.
  • This way Player 11, 22, and 44 are suspended.

Samples

5
3
1 2
2
0 0
4
6 0
3
3 3
10
11 5
2
0
3
3
10

在线编程 IDE

建议全屏模式获得最佳体验