Apart from Nian, there are 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 is Sui tries to approach them, it'll 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 1018, such that there is exactly k loops in the decimal repre Sentation 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 are one loop in digit 4, and the other loops in 8 and no loops in 5. Refer to the figure below for all exact forms. Input
The first and only line contains an integer k (1≤k≤106)-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 is a positive decimal integer not exceeding 1018. Examples Input
2
Output
462
Input
6
Output
8080
Test instructions: For a number containing n rings, give the number not more than 1e18,
For example, 3,5,7 contains 0 rings; 8 contains 2 rings; 0,4,6,9 contains 1 rings
Thinking: 888888888888888888 contains 36 rings, which is the largest number of rings in 1e18
If N%2==1 first print 6, then print N/2 8;
N%2==0 straight back print N/2 a 8
#include <bits/stdc++.h>
using namespace std;
int main () {
int n;
scanf ("%d", &n);
if (n>36) printf (" -1\n");
else{
int k=n%2;
if (k) printf ("6");
for (int i=0;i<n/2;i++)
printf ("8");
printf ("\ n");
}
return 0;
}