B. Yet Another Matchsticks Problem
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You have $$$n$$$ matchsticks.Your task is to combine them to make a number..

Here're some restrictions:

  1. Each and every digit must be put together exactly as shown in the image above.
  2. You don't need to use up all $$$n$$$ marchsticks.
  3. Leading zeros are not permitted in the number.
  4. The number's digits cannot go beyond k.

Find the largest possible number.

Input

The first line of input will contain a single integer $$$t(1 \leq t \leq 1000)$$$, denoting the number of test cases.

Each test case consists of a line of input.The only line of each test case contains two integers $$$n(2 \leq n \leq 1000),k(1 \leq k \leq 1000)$$$.

Output

For each test case, output on a new line — the the biggest number you can get.

Example
Input
3
1000 1
2 1000
9 2
Output
9
1
97