Digit Problem

Time Limit : 1 Second

Memory Limit : 512 MB

Submission: 12

Solved: 4

Description

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.

Input

The input contains a line with a single integer n (1 <= n <= 5000)

Output

Ouput the minimal sum of these n positive integers, these n positive integers have same sum of digits.

sample input
3
sample output
33
hint
source
© 2015 HUST ACMICPC TEAM. All Right Reserved.