Tony and cars

3.4

57 votes
Very-Easy
Problem

Tony is an employee at a mall. His job is to label each vehicle entering into the parking with a unique number. He starts labelling the car with 1 , 2 ,3…. N (First car with number 1, Second car with number 2 and so on).

Tony wants to know how many digits he will have to write down in a day as he labels the arriving N cars. Input: First line contains T, the number of test cases to follow. (1<=T<=1000) Each test case contains a integer n (1<=n<10^12) denoting number of cars in a day.

Output: For each test case print number of digits required to label the n cars.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Sample

input
13
output
17
input
4
output
4

Explanation:

Note to the first test. The cars get numbers 1,2,3,4,5,6,7,8,9,10,11,12,13, which totals to 17 digits.
Note to the second sample. The cars get numbers 1,2,3,4, which totals to 4 digits.

Editor Image

?