$f=[] a=1;b=1;35.times{|i|$f+=[a];c=b+a;a=b;b=c} def c d i=0 while !(d<$f[i+1]);i+=1;end [i,d-$f[i]] end def x n f=c(n) a="0"*(f[0]-1)+"11" while f[1]>0 f=c(f[1]) a[f[0]-1]="1"[0] n=f[1] end a end def b d v=0 d.length.times{|i| v*=2;v+=d[i..i].to_i } v end def r d,i /^(0*)/=~d[i,9] if($1==nil);[1,1] else n=$1.length m=2**n+b(d[i+n+1,n])-1 [2**m+b(d[i+n*2+1,m]),n*2+m+1];end end while gets n=0 d=$_.chomp while d.length>n a=r d,n print x a[0] n+=a[1] end puts end