Under construction

Still being built. Things may change

RUN Number

Time limit1sMemory limit1024 MB

Summary
Given an N-digit number K, write K as a sum of at most N+1 RUN numbers (repdigits) and print the terms.
Level

Medium5 of 10

Topics
Math, Implementation, Greedy
Solved
No attempts yet

Problem

A positive integer xx is called a RUN number if all of its digits are the same digit. For example, 44, 111111, and 888 888888\,888 are RUN numbers, but 2727, 334334, and 100 000100\,000 are not.

Given an NN-digit number KK, express KK as a sum of at most (N+1)(N+1) RUN numbers. It can be proven that this is always possible.

Input

The first line contains the number of test cases TT.

Each test case consists of one line with two integers NN and KK, separated by a space.

Output

For each test case, print the following.

  • On the first line, print the number MM of RUN numbers whose sum is KK (1≤M≤N+11\le M\le N+1).
  • On the second line, print the MM RUN numbers separated by spaces. If multiple answers exist, print any of them.

Constraints

  • 1≤T≤1001\le T\le 100
  • 1≤N≤171\le N\le 17
  • 10N−1≤K<10N10^{N-1}\le K<10^N. That is, KK is an NN-digit number.

Examples2

  1. Example 1

    Input
    2
    4 2024
    3 506
    
    Expected output
    4
    999 999 22 4
    3
    444 55 7
    
  2. Example 2

    Input
    2
    17 99999999999999999
    9 333666999
    
    Expected output
    1
    99999999999999999
    3
    333333333 333333 333