for(x<-"c"*100;s="0"*x+readLine+"1"*9)println{var i=99;for(c<-1 to 8)i+=s(i)%3*c-c;s(i)}