P24656 [AtCoder] Repunit Trio
入门
题目描述

Problem Statement

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 Input 1

5

Sample Output 1

113

The integers that can be expressed as the sum of exactly three repunits are $3, 13, 23, 33, 113, \ldots$ 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 Input 2

19

Sample Output 2

2333

Sample Input 3

333

Sample Output 3

112222222233

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5
样例输出
113