#!ruby -p sub($_[d=0,$&.to_i(2)]){e=$&.to_i 2 1while(a=b=c=1 c*=10until e