Time limit
2s
Memory limit
256 MB
A lucky number is a positive integer whose decimal representation consists only of the digits 4 and 7.
Given a natural number N, find the largest lucky number that is less than or equal to N.
The first line contains a natural number N. N is at least 4 and at most 1,000,000.
Print the largest lucky number that is less than or equal to N.