logo AlgoBeat OnlineJudge
登录 注册

#216855. [GKS 2022 #A] Challenge Nine

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

题目描述

Ada gives John a positive integer . She challenges him to construct a new number (without leading zeros), that is a multiple of , by inserting exactly one digit () anywhere in the given number . It is guaranteed that does not have any leading zeros.

As John prefers smaller numbers, he wants to construct the smallest such number possible. Can you help John?

输入格式

The first line of the input gives the number of test cases, . test cases follow.

Each test case has a single line containing a positive integer : the number Ada gives John.

输出格式

For each test case, output one line containing Case : , where is the test case number (starting from ) and is the new number constructed by John. As mentioned earlier, cannot have leading zeros.

样例

样例输入 1

3
5
33
12121

样例输出 1

Case #1: 45
Case #2: 333
Case #3: 121212

数据范围与提示

In Sample Case #, there are only numbers that can be constructed satisfying the divisibility constraint: and . John chooses the smaller number.

In Sample Case #, is the only number possible.

In Sample Case #, there are possible options - , , and - out of which the smallest number is .

Limits

.

Test Set

.

Test Set

For at most cases:

.

For the remaining cases:

.