atcoder#ARC153A. [ARC153A] AABCDDEFE
[ARC153A] AABCDDEFE
Score : points
Problem Statement
A positive integer is said to be a beautiful integer if and only if is a -digit integer whose decimal notation ( is the -th character) satisfies all of the following conditions:
- is not
0
, - ,
- , and
- .
For instance, and are beautiful integers, while is not, since .
You are given a positive integer . Print the -th smallest beautiful integer.
Constraints
- is a positive integer.
- There are at least beautiful integers.
Input
The input is given from Standard Input in the following format:
Output
Print the -th smallest beautiful integer.
3
110000020
The beautiful integers in ascending order are .
882436
998244353
2023
110200222