QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#18333. Run Number

统计

We call a positive integer $x$ a run number if all digits of $x$ are the same. For example, $4$, $111$, $888\,888$ are run numbers, while $27$, $334$, $100\,000$ are not.

Given an $n$-digit number $k$, represent $k$ as a sum of at most $(n + 1)$ run numbers. One can prove that a solution always exists.

Input

The first line contains an integer $t$, the number of test cases ($1 \le t \le 100$).

Each test case consists of one line containing two integers: $n$ and $k$ ($1 \le n \le 17$, $10^{n - 1} \le k < 10^n$).

Output

For each test case:

  • On the first line, print an integer $m$: the number of run numbers which add up to $k$ ($1 \le m \le n + 1$).
  • On the second line, print the $m$ run numbers in any order.
  • If there are multiple solutions, print any one of them.

Examples

Input 1

2
4 2024
3 506

Output 1

4
999 999 22 4
3
444 55 7

Input 2

2
17 99999999999999999
9 333666999

Output 2

1
99999999999999999
3
333333333 333333 333

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.