#T575. 数码统计

数码统计

Description

Little A has been reading a book recently, said to be The Classic Training Guide for Algorithm Competitions. He has been reading it for quite a few days. One day, he suddenly had a flash of inspiration—his soul seemed to leave his body—and came up with a question:

Among the pages he has read so far, each page has a unique page number starting from 1. Now he wants to know how many digits in total have appeared across all the page numbers he has read.

For example: If he has read up to page 57, then from pages 1 to 57, there are a total of 103 digits.
Given the sheer thickness of this book, as a COIer, can you write a program to help him solve this problem?

Input Format

The first line contains a positive integer T (≤100), representing the number of test cases. Each subsequent line contains a positive integer n (≤10^9).

Output Format

For each test case, the output consists of two lines. The first line follows the format: Case #:, where # is the test case number.
The second line contains a single integer, representing the result.

1
12

Case 1:
13

来源

CodesOnline