Magical Number
题号:NC213987
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
64bit IO Format: %lld

题目描述

We consider a natural number p withk digits,, is magical only when it satisfies:
Every number composed by leading digits of p can be divisible by the number of its digits.
More formally,∀i∈[1,k].

For example, 123 is magical, because1|1, 2|12, 3|123.

However124 is not magical, because 3∤124.

Every digit can be composed with match sticks in the following ways.

What is the largest posible magical number you can compose with exactly n match sticks?

输入描述:

The input contains a integer n(1≤n≤10100), the number of match sticks you have.

输出描述:

Print the largest posible magical number x that can be possibly composed with exactly n match sticks.

If the number doesn't exist, print -1.

示例1

输入

复制
3

输出

复制
7
示例2

输入

复制
7

输出

复制
74
示例3

输入

复制
10000

输出

复制
-1