i,s;main(){char b[9999];gets(b);for(;b[i];)printf("%c",b[i]),s+=b[i++]-'0',!(s=s%7*10)&&puts("");}