QOJ.ac

QOJ

时间限制: 3 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#18696. Length String

统计

A "length string" is defined as a string consisting only of digits $0-9$ and hyphens ('-') that satisfies the following conditions:

  • No two or more hyphens appear consecutively.
  • The first character of the string is not '0'.
  • The last character of the string is not '-'.
  • A '0' does not appear immediately after a '-'.
  • The longest suffix consisting only of digits, when interpreted as a decimal number, is equal to the length of the string. If such a suffix is an empty string, it is interpreted as 0.
  • If the string contains a '-', the substring from the beginning of the string up to the character before the last '-' is also a length string.

For any non-negative integer $n$, there exists a unique length string of length $n$. Below are examples of length strings of lengths 5, 8, and 13, respectively:

1-3-5 -2-4-6-8 1-3-5-7-10-13

Given a natural number $a$ and a non-negative integer $b$, find the length string of length $a \times 10^b$.

Input

The first line contains the number of test cases $T$ ($1 \le T \le 100\,000$). Each test case consists of two integers $a$ and $b$ separated by a space ($1 \le a \le 10^9$, $0 \le b \le 10^6$).

Output

For each test case, output the length string of length $a \times 10^b$. If $a \times 10^b \ge 21$, output only the first 17 characters of the string followed by ... as shown in the examples.

Examples

Input 1

3
5 0
8 0
13 0

Output 1

1-3-5
-2-4-6-8
1-3-5-7-10-13

Input 2

2
25 4
32 6

Output 2

1-3-5-7-10-13-16-...
-2-4-6-8-11-14-17...

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.