Time Limit: 1s
Memory Limit: 512MB
Keqiang was interested in integers with equal sum of digits these days. He asked Jinping to find n positive integers with equal sum of digits. The requirement is minimal these integers’ total sum. Jinping was tired now and ask for you to handle this problem.
The input contains a line with a single integer n (1 <= n <= 5000)
Ouput the minimal sum of these n positive integers, these n positive integers have same sum of digits.