1813: Pendant

内存限制:128 MB 时间限制:20.000 S
评测方式:文本比较 命题人:
提交:23 解决:11

题目描述

On Saint Valentine‘s Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of pearls, and its length is defined as the number of pearls in it. As is known to all, Alex is very rich, and he has N pearls of each kind. Pendant can be told apart according to permutation of its pearls. Now he wants to know how many kind of pendant can he made, with length between 1 and N. Of course, to show his wealth, every kind of pendant must be made of exactly K pearls. Output the answer taken modulo 1234567891.

输入

The input consists of multiple test cases. The first line contains an integer T indicating the number of test cases. Each case is on one line, consisting of two integers N and K, separated by one space. Technical Specification 1. 1 <= T <= 10 2. 1 <= N <= 1,000,000,000 3. 1 <= K <= 30

输出

Output the answer on one line for each test case.

样例输入 复制

2
2 1
3 2

样例输出 复制

2
8