logo AlgoBeat OnlineJudge
登录 注册

#209286. [EC Final 2022] Best Carry Player 2

内存限制:1024 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Given a positive integer , find the minimum positive integer such that the number of of is exactly .

We adds numbers , just like what we normally do in primary school. For example, there are two carries in the following addition.

which means 进位 in Chinese.

输入格式

The first line contains an integer the number of test cases.

For each test case, the first line contains two integers .

输出格式

For each test case, output one integer representing the answer in one line. If there is no solution, output instead.

样例

样例输入 1

4
12345678 0
12345678 5
12345678 18
990099 5

样例输出 1

1
54322
999999999987654322
9910