f=->n{n*~-n/2} g=->k{(0..2*k).find{|e|f[e]>=k}} k=gets.to_i d=f[a=g[k]]-k c=f[b=g[d]]-d p a+c+1 puts [*[1]*a-=b,*[2]*b,*[7]*c,24]*' '