y='' for s in input(): y+=s if int(y)%7<1:print(y);y=''