11103 - Problem B. Math Question   

Description

The Legend of Condor Heroes is a wuxia novel by Jin Yong (Louis Cha). It is the first part of the Condor Trilogy, and is followed by The Return of the Condor Heroes and The Heaven Sword and Dragon Saber.

In the story, there is a very smart character called Huang Rong. Huang Rong was born to Huang Yaoshi and Feng Heng. Her mother died shortly after she was born and her father raised her all by himself on Peach Blossom Island. She was an intelligent child and quick learner, so her father imparted her with all his skills and knowledge. She fled from home after an argument with her father and disguised herself as a beggar by donning filthy rags.

In the middle of the story, she had a math battle against Yin Gu. Finally, she solved the question faster to win the game. Here’s the question: Compute C(n,mmod 1000000007(109 + 7). Could you solve this quickly? 

Input

The first line contains an integer T (T 10), which indicates the number of test cases. For each case, one line contains two integers n,m (1 n 107,1 m n). 

Output

For each case, output the answer. Follow the format of sample output. 

Sample Input  Download

Sample Output  Download

Tags




Discuss