问题 E: The Luckiest Number

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:7 解决:4

题目描述

Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the minimum among all positive integers that are a multiple of L and consist of only digit '8'.

输入

The input consists of multiple test cases. Each test case contains exactly one line containing L(1 ≤ L ≤ 2,000,000,000).
The last test case is followed by a line containing a zero.

输出

For each test case, print a line containing the test case number( beginning with 1) followed by a integer which is the length of Bob's luckiest number. If Bob can't construct his luckiest number, print a zero.

样例输入 复制

8
11
16
0

样例输出 复制

Case 1: 1
Case 2: 2
Case 3: 0

来源/分类