main = interact $ show . process . read
process n 
	| even m = b $ m 
    | otherwise = ( a n m ) + ( b $ m - 1 )
	where
    	m = k n
    	k 0 = 0
        k t = 1 + (k $ div t 10)
        a n m = n + 1 - (10 ^ (m - 1))
        b x = div ( 10 ^ x - 1 ) 11

        