403178: GYM101061 G Repeat it

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Repeat ittime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

Jad has bought a new computer, a really weird computer!!

Every time he copies some number from the screen and pastes it, the computer pastes it many times instead of once!

Jad tested his computer many times, and now he knows how many times the computer will paste each copied number.

For example, In case the new computer repeated each copied number 4 times. When Jad copies the number 31 and pastes it, the number that appears on the screen would be 31313131.

Given N the number that Jad copied, and M the number of times the new computer is pasting each copied number. you have to print the number that will appear on the screen.

Since the number might be very big, you are asked to print it modulo 1000000007.

Input

The first line of the input consists of a single integer t, the number of test cases. Each test case consists of two numbers M and N separated by a single space:

(1 ≤ M ≤ 109) is the number of times the new computer pasted the number N.

(0 ≤ N ≤ 109) is the number Jad had copied.

Output

For each test case print one line, the number that will appear on the screen modulo 1000000007.

ExampleInput
3
4 31
8 1
123 123
Output
31313131
11111111
388853804

加入题单

上一题 下一题 算法标签: