The digit sum of a positive integer x is the sum of its decimal digits. For example, 2, 11, and 20 all have digit sum 2.
Pick n distinct positive integers whose digit sums are all equal. Write a program that finds the smallest total the picked numbers can have.
The first line contains an integer n (1≤n≤5000).
Print the minimum possible sum of n distinct positive integers that all have the same digit sum.