NUMBERS FROM MATCHSTICKS#8297

NUMBERS FROM MATCHSTICKS

1 second
64 megabytes
Hard (≈1650)

Using a set number of matches and following specific templates to represent digits, you can form various natural multi-digit numbers. What are the smallest and largest numbers you can create using exactly matches?

z2.jpg

Input

A natural number – representing the number of matches (2 \leq K \leq 200).

Output

Answer to the problem.

Examples

Example 1

Loading
Loading