n=input() m='' while n:m=`n`[-2]+'\n'[n%7:]+m;n/=10 print m