Time limit
2s
Memory limit
128 MB
Eunmin likes only the digits 4 and 7. A lucky number is a positive integer whose decimal representation consists only of 4 and 7.
Given an integer N, represent N as a sum of one or more lucky numbers. If multiple representations exist, output one that uses the fewest numbers. If there is still more than one such representation, output the lexicographically smallest sequence when compared from left to right. If N cannot be represented, output -1.
For two representations N = a1 + a2 + ... + ak and N = b1 + b2 + ... + bk, the first representation is earlier if, at the smallest index i where ai and bi differ, ai < bi.
The first line contains N. N is at most 1,000,000.
Print the answer on the first line, separating numbers with spaces.