1020: Kth smallest 0 and 2
[Creator : ]
Description
Among the positive integers that consist of $0$'s and $2$'s when written in base $10$, find the $K$-th smallest integer.
Input
A single integer $K$.
$K$ is an integer between $1$ and $10^{18}$ (inclusive).
$K$ is an integer between $1$ and $10^{18}$ (inclusive).
Output
Print the answer as an integer.
Here, the exact value must be printed as an integer, even if it is big. Exponential notations such as `2.34e+22`, for example, or unnecessary leading zeros such as `0523` are not allowed.
Here, the exact value must be printed as an integer, even if it is big. Exponential notations such as `2.34e+22`, for example, or unnecessary leading zeros such as `0523` are not allowed.
Sample Input Copy
11
Sample Output Copy
2022
HINT
Think about binary.