You have number *a*, whose decimal representation quite luckily contains digits 1, 6, 8, 9. Rearrange the digits in its decimal representation so that the resulting number will be divisible by 7.

Number *a* doesn't contain any leading zeroes and contains digits 1, 6, 8, 9 (it also can contain another digits). The resulting number also mustn't contain any leading zeroes.
The first line contains positive integer *a* in the decimal record. It is guaranteed that the record of number *a* contains digits: 1, 6, 8, 9. Number *a* doesn't contain any leading zeroes. The decimal representation of number *a* contains at least 4 and at most 10<sup class="upper-index">6</sup> characters.
a=input()

count0=0
resp=''
vez1=True
vez2=True
vez3=True
vez4=True
for i in a:
    if i=='0':
        count0+=1
    elif i=='1' and vez1==True:
        vez1=False
    elif i=='6' and vez2==True:
        vez2=False
    elif i=='8' and vez3==True:
        vez3=False
    elif i=='9' and vez4==True:
        vez4=False
    else:
        resp+=i

if resp!='':

    summ=int(resp)%7
else:
    summ=0

if summ%7==1:
    resp+='6891' #ok
elif summ%7==2:
    resp+='1896'  #ok
elif summ%7==3:
    resp+='9816' #ok
elif summ%7==4:
    resp+='9861' #ok
elif summ%7==5:
    resp+='1968'  #ok
elif summ%7==6:
    resp+='8691' 
else:
    resp+='1869' #ok 

resp+='0'*count0
print(resp)
			    				 	  			 		 		 						