Problem H. Holes

Author:ACM ICPC 2008-2009, NEERC, Northern Subregional Contest   Time limit:3 sec
Input file:holes.in   Memory limit:256 Mb
Output file:holes.out  

Statement

You may have seen a mechanic typewriter — such devices were widespread just 15 years ago, before computers replaced them. It is a very simple thing. You strike a key on the typewriter keyboard, the corresponding type bar rises, and the metallic letter molded into the type bar strikes the paper. The art of typewriter typing, however, is more complicated than the art of computer typing. You should strike keys with some force otherwise the prints will not be dark enough. Also you should not overdo it otherwise the paper will be damaged.

Imagine a typewriter with very sharp letters, which cut the paper instead of printing. It is clear that digit 0 being typed on the typewriter makes a nice hole in the paper and you receive a small paper oval as a bonus. The same happens with some other digits: 4, 6, 9 produce one hole, and 8 produces two touching holes. The remaining digits just cut the paper without making holes.

The Jury thinks about some exhibition devoted to the oncoming jubilee of Pascal language. One of the ideas is to make an art installation, consisting of an empty sheet of paper with exactly h holes made by typing a non-negative integer number on the cutting typewriter described above. The number must be minimal possible and should not have leading zeroes. Unluckily we are too busy with preparing the ACM quarter- and semifinals, so we need your help and ask you to write a computer program to generate the required number.

Input file format

A single integer number h — the number of holes.

Output file format

The integer number which should be typed.

Constraints

0 ≤ h ≤ 510.

Sample tests

No. Input file (holes.in) Output file (holes.out)
1
0
1
2
1
0
3
15
48888888
4
70
88888888888888888888888888888888888

0.104s 0.009s 13