#P6333. Problem B. Harvest of Apples

Problem B. Harvest of Apples

Problem Description

There are $n$ apples on a tree, numbered from $1$ to $n$.
Count the number of ways to pick at most $m$ apples.

Input

The first line of the input contains an integer $T$ $(1 \le T \le 10 ^ 5)$ denoting the number of test cases.
Each test case consists of one line with two integers $n, m$ $(1 \le m \le n \le 10 ^ 5)$.

Output

For each test case, print an integer representing the number of ways modulo $10 ^ 9 + 7$.

2 5 2 1000 500
16 924129523