k=0 s=0 n=gets.to_i while s=n p ('1'*(i+1)+'0'*(s+m-i-n+1)+'1'*(k-i-1-(s+m-i-n+1))).to_i(2) break else s+=m-i i+=1 end end