408404: GYM103114 H Hsueh- and Meeting

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hsueh- and Meetingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

When you first joined the ACM Lab, you were full of ambition, but you always lying in bed eating potato chips, watching anime, and planning your future training plan and goals. As a result, an immature ACMer was stumbled by the sluggish life. On this day, Your senior, gold medal player Hsueh can't bear your depraved and degraded life. In order to revive the glory of ACM Lab in HZNU, he decided to hold a temporary meeting to remind everyone.

Due to the prevention and control of the COVID-19, everyone must sit apart when they come to the conference room.In other words, there at least one empty seat between two people. Assuming that there is a large round table in the conference classroom, you are required to judge whether it can accommodate all laboratory members. If so, output the total number of seating plans; otherwise, output $$$0$$$.

Since the answer can be very large, you have output it modulo $$$10^9+7$$$.

Input

The first line contains one integer $$$T(1 \leq T \leq 100)$$$, which represents the number of test case.

For each test case, the first line consists of two integers $$$n,m (1 \leq n,m \leq 10^5)$$$, the number of people in the laboratory and the number of seats in the meeting room. Each person and seat is considered to be different.

Output

For each test case, output an integer representing the total number of different seating plans.

ExampleInput
1
2 4
Output
4

加入题单

算法标签: