2708. Holes

单点时限: 5.0 sec

内存限制: 256 MB

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 (0 \leqslant h \leqslant 510)$

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.


A single integer number $h$ ― the number of holes.


The integer number which should be typed.



755 人解决,788 人已尝试。

893 份提交通过,共有 1428 份提交。

0.3 EMB 奖励。

创建: 11 年,8 月前.

修改: 1 年,10 月前.

最后提交: 3 天,23 小时前.

来源: NEERC 2008