Under construction

Still being built. Things may change

Length String

Time limit3sMemory limit1024 MB

Summary
Given a and b, output the length string of length a times 10 to the power b, printing only the first 17 characters when that length is at least 21.
Level

Hard8 of 10

Topics
String, Math, Implementation
Solved
No attempts yet

Problem

A length string is a string made only of the digits 0 to 9 and hyphens ('-') that meets the following conditions.

  • Two or more hyphens do not appear in a row.
  • The first character is not '0'.
  • The last character is not '-'.
  • The digit '0' does not come right after a hyphen.
  • Read as a base-10 number, the longest suffix made only of digits equals the length of the string. If that suffix is empty, it is read as 0.
  • If the string contains a hyphen, the length string is the substring from the start up to the last hyphen.

For every non-negative integer nn, there is exactly one length string of length nn. The following are length strings of lengths 55, 88, and 1313.

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

Given a positive integer aa and a non-negative integer bb, find the length string of length a×10ba \times 10^b.

Input

The first line contains the number of test cases TT. (1≤T≤100 0001 \leq T \leq 100\ 000)

Each test case is given on one line with two integers aa and bb, separated by a space. (1≤a≤1091 \leq a \leq 10^9, 0≤b≤1060 \leq b \leq 10^6)

Output

For each test case, print the length string of length a×10ba \times 10^b. If a×10b≥21a \times 10^b \geq 21, print only the first 17 characters, in the same format as the example.

Examples2

  1. Example 1

    Input
    3
    5 0
    8 0
    13 0
    
    Expected output
    1-3-5
    -2-4-6-8
    1-3-5-7-10-13
    
  2. Example 2

    Input
    2
    25 4
    32 6
    
    Expected output
    1-3-5-7-10-13-16-...
    -2-4-6-8-11-14-17...