m=8**9/7 while read -n1 s;do((a+=8**s/8));done for t in {0..8} {(((a+=8**t,o=a&a/4&m))||($[o|=a&m*5] eval h=8**{0..8}' ((a/h%8>1))&&{ j= b=a-2*h f="b-=b+1&4?3:~(b|b/2|b/4)&73?j+=b%8,b-b/8:73,b&&f" $[f,o*=j] } ' ((o))||echo $[t+1]))}