Problem9149--ABC333 —— C - Repunit Trio

9149: ABC333 —— C - Repunit Trio

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

A repunit is an integer whose digits are all $1$ in decimal representation. The repunits in ascending order are $1, 11, 111, \ldots$.

Find the $N$\-th smallest integer that can be expressed as the sum of exactly three repunits.

Input

The input is given from Standard Input in the following format:

```
$N$
```

Output

Print the answer.

Constraints

-   $N$ is an integer between $1$ and $333$, inclusive.

Sample 1 Input

5

Sample 1 Output

113

The integers that can be expressed as the sum of exactly three repunits are 3,13,23,33,113,… in ascending order. For example, 113 can be expressed as 113=1+1+111.

Note that the three repunits do not have to be distinct.

Sample 2 Input

19

Sample 2 Output

2333

Sample 3 Input

333

Sample 3 Output

112222222233

HINT

相同题目:ABC333

Source/Category