enum M{M;int i,j=1;{for(;i<1001;j=++i/10%10)if((803>>i/100^251>>j^(j==1?771:802)>>i%10)%2>0)System.out.println(i);}}