Problems
600 - Sum of Digits
SUBMIT PROBLEM

Sum of Digits

Time Limit: 3 sec

 

The Problem

Given a positive integer number N, you need to calculate the sum of all digits between 1 and N.

 

Example:

For N = 12

Sum of All digit between 1 and N are

= 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 + 1 + 1 + 1 + 2

= 51

 

The Input

The input begins with a single positive integer T on a line by itself indicating the number of the cases following. Each test case contains the number N.

 

Constraints

[0 < T < 10000]

[1 ≤ N ≤ 10^9]



The Output

For each test case, print “Case X: S”, here X is the case number start from 1 to T and S is the sum of all digit between 1 and N.

 

Sample Input

2

12

5

 

Sample Output

Case 1: 51

Case 2: 15





Problem Setter: Shahin ShamS