logo AlgoBeat OnlineJudge
登录 注册

#216949. [ICPC 2017 Shenyang R] New Self-describing Sequence

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

题目描述

Let be an integer sequence beginning with . For , is the sum of and the sum of digits of . That’s why we name the sequence a new Self-describing sequence.

The sequence starts with and we also define the prefix sum . For given positive integer , find and .

输入格式

The first line of input consists an integer (), indicating the total number of test cases. Each of the following lines provides an integer ().

输出格式

For each test case output its case label first. Then for given , output and . Since the prefix sum is large, you only need to output . However you should output as its exact value.

样例

样例输入 1

7
6
66
666
6666
66666
123456789
31415926535897932

样例输出 1

Case #1: 23 54
Case #2: 752 20862
Case #3: 10949 3407733
Case #4: 136193 441127485
Case #5: 1698899 717710112
Case #6: 5061289531 990040993
Case #7: 2508156610654066874 660828136