CP doubt / query

pls resolve the time limit exceeded…the logic probably is fine for numbers having no. of digit <300

==== question =====

Mr. Erato loves number theory and the uniqueness of prime numbers. One of his Students Eric Failed his tests because of Plagiarism and came to him to plead for help!

Mr. Erato gave a task to his student Eric who failed to find a number that is divisible by all the single-digit prime numbers to pass his course. Eric laughed and said this is so easy to which grinningly Erato replied “Not so easy Chap! The condition to finding the number is that it should be an n digit number and it should be the smallest out of them.” Help Eric to figure out the solution to this problem so that Erato is proud of him and he passes his Math exam.

Note: 0023, 0210 are not valid 4 digit numbers.

Input

A single input line contains a single integer n (1 ≤ n ≤ 10^5)

Output

Print -1 if the required number doesn’t exist. If it exists then output it as a single number.

Examples

input

5

output

10080

input

1

output

-1

Hey @prerak_semwal this is a python code, i am proficient in C++. The best i can do is tell you an optimised approach. So if it works, tell me about the approach you are using. Will tell an efficient way.

@mr.encoder
If no. of digits <=2 print(-1)
else if ==3 print(210)
else
{
keep multiplying 210 with 2 till its number of digits is >=n.

then check if we divide this by 4 and multiply by 3 do we get a smaller number satisfying constraints…if yes do this and keep doin till u get smallest no. under giving constraints
}

Share the link of the question , so that i can help you accordingly.

@mr.encoder
I have copied the whole question… also u won’t be able to access that question

Then how will i check if the approach i will be telling you is right or not. Do share question link.

@mr.encoder
Your id won’t be able to access this question this is only for authorised id’s of my college… i have shared the questio as it is copy-paste !!

Not sure about this question, as when n=5 it means 100000 (5 digit number)
So 10^5 menas (10^100000) digit number,