300570: CF109A. Lucky Sum of Digits

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Lucky Sum of Digits

题意翻译

## 题目描述 Petya喜欢幸运数字。我们都知道幸运数字是只含有$4$ 和$7$ 的正整数。例如数字$47$ ,$744$ ,$4$ 是幸运数字,而$5$ ,$17$ ,$467$ 不是。 Petya急切的想知道各个数位上数字的和为$n$ 的最小幸运数字是多少。帮助他完成这个任务。 ### 输入格式: 一行一个整数$n$ ($1\leq n\leq 10^6$ ) — 要求的幸运数字各个数位上数字的和。 ### 输出格式: 输出仅一行为这个结果 — 这个最小的各数位上和为$n$ 的幸运数。如果这个数不存在输出-1。 感谢@Khassar 提供的翻译

题目描述

Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya wonders eagerly what minimum lucky number has the sum of digits equal to $ n $ . Help him cope with the task.

输入输出格式

输入格式


The single line contains an integer $ n $ ( $ 1<=n<=10^{6} $ ) — the sum of digits of the required lucky number.

输出格式


Print on the single line the result — the minimum lucky number, whose sum of digits equals $ n $ . If such number does not exist, print -1.

输入输出样例

输入样例 #1

11

输出样例 #1

47

输入样例 #2

10

输出样例 #2

-1

Input

题意翻译

## 题目描述 Petya喜欢幸运数字。我们都知道幸运数字是只含有$4$ 和$7$ 的正整数。例如数字$47$ ,$744$ ,$4$ 是幸运数字,而$5$ ,$17$ ,$467$ 不是。 Petya急切的想知道各个数位上数字的和为$n$ 的最小幸运数字是多少。帮助他完成这个任务。 ### 输入格式: 一行一个整数$n$ ($1\leq n\leq 10^6$ ) — 要求的幸运数字各个数位上数字的和。 ### 输出格式: 输出仅一行为这个结果 — 这个最小的各数位上和为$n$ 的幸运数。如果这个数不存在输出-1。 感谢@Khassar 提供的翻译

加入题单

算法标签: