GM - Good Mixture!!!

no tags 

A Good Mixture is a sequence of digits obtained by writing down decimal representations of all integers starting with 1 and continuing up to a certain number N consecutively like this:

12345678910111213141516171819202122 ... etc.

Write a program that will compute the number of digits in such a sequence.

INPUT

First line of input contains an integer t, t<=200, representing the number of test-cases. Then t lines follow each containing an integer N, 1<=N<=10^9

OUTPUT

For each test case output should contain the number of digits in a sequence determined by the number given in the input.

SAMPLE

Input
3
5
15
120
Output
5
21
252


hide comments
Mitch Schwartz: 2014-01-28 21:32:58

Moved to tutorial.


Added by:BLANKRK
Date:2014-01-28
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64