Problem: Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.

One day Petya came across a positive integer n. Help him to find the least super lucky number which is not less than n.

Input

The only line contains a positive integer n (1 ≤ n ≤ 10100000). This number doesn't have leading zeroes.

Output

Output the least super lucky number that is more than or equal to n.

Examples

Input

4500


Output

4747


Input

47


Output

47

Solution (in PYTHON3):

Solution:
sa=int(input())
suplucky=[47, 74, 4477, 4747, 4774, 7447, 7474, 7744, 747447, 744747, 744774, 477744, 444777, 777444, 447477, 747474, 774744, 474774, 474477, 447747, 774474, 447774, 744477, 774447, 747744, 477447, 477474, 474747]
supluckyb=[44747747, 77774444, 74747744, 44477774, 47447774, 77744474, 77444477, 47744774, 74477474, 74744774, 44774477, 77444747, 74474747, 74447747, 74447774, 44747774, 74477447, 74474477, 47744747, 47474747, 77447474, 77444774, 77474744, 74447477, 77474447, 74747474, 74774744, 47744477, 74777444, 44447777, 47747474, 47774474, 47747447, 44774747, 47444777, 44474777, 77474474, 74477744, 47477744, 74474774, 74747447, 47447477, 47477447, 44477477, 77747444, 77744744, 44744777, 77477444, 74744477, 47474774, 74444777, 44747477, 44777744, 47774744, 44777447, 47477474, 47447747, 47777444, 74774447, 44477747, 77447447, 77744447, 74774474, 44774774, 74744747, 47774447, 47474477, 77447744, 44777474, 47747744]
superlucky=suplucky+supluckyb
superlucky.sort()
element=0
sas=[]
for element in superlucky:
    if element>=sa:
        sas.append(element)
if sas==[]:
    print(4444477777)
else:
    print(min(sas))