Codeforces Round 462 (Div. 2)
B
A Prosperous Lot
Codeforces
1200
原题
← AC →
翻译中…

Apart from Nian, there is a daemon named Sui, which terrifies children and causes them to become sick. Parents give their children money wrapped in red packets and put them under the pillow, so that when Sui tries to approach them, it will be driven away by the fairies inside.

翻译中…

Big Banban is hesitating over the amount of money to give out. He considers loops to be lucky since it symbolizes unity and harmony.

翻译中…

He would like to find a positive integer $*n*$ not greater than $10^{18}$, such that there are exactly $*k*$ loops in the decimal representation of $*n*$, or determine that such $*n*$ does not exist.

翻译中…

A loop is a planar area enclosed by lines in the digits' decimal representation written in Arabic numerals. For example, there is one loop in digit $4$, two loops in $8$ and no loops in $5$. Refer to the figure below for all exact forms.

翻译中…

image

翻译中…

Input

翻译中…

The first and only line contains an integer $*k*$ ($1 ≤ *k* ≤ 10^{6}$) — the desired number of loops.

翻译中…

Output

翻译中…

Output an integer — if no such $*n*$ exists, output -1; otherwise output any such $*n*$. In the latter case, your output should be a positive decimal integer not exceeding $10^{18}$.

翻译中…

样例

Input #1
2
Output #1
462
InputCopy OutputCopy
Input #2
6
Output #2
8080
InputCopy OutputCopy
题目信息
题号
934B
时间限制
1 s
内存限制
256 MB
标签
构造
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。