codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

109A.md (878B)


      1 Source: https://codeforces.com/problemset/problem/109/A
      2 
      3 A. Lucky Sum of Digits
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 Petya wonders eagerly what minimum lucky number has the sum of digits equal to *n*. Help him cope with the task.
     24 
     25 Input
     26 
     27 The single line contains an integer *n* (1 ≤ *n* ≤ 106) — the sum of digits of the required lucky number.
     28 
     29 Output
     30 
     31 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.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 11
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 47
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 10
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 -1
     57 ```