A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.

The first line contains a single integer n (1 ≤ n ≤ 106).

In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers. In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.

 type niz=array[-1..1000000] of longint;
procedure sort(var a:niz;n:longint);
 var  i,h,s,f,l:longint;
begin

 for i:=2 to n do
  begin
   h:=a[i]; s:=i;f:=s div 2;
   while ((s>1) and (a[f]<h)) do
   begin
     a[s]:=a[f]; s:=f; f:=s div 2;
   end;
  a[s]:=h;
 end;
 for i:=n downto 2 do
  begin
   l:=a[i]; a[i]:=a[1]; f:=1;
   if ((i-1>=3) and (a[3]>a[2]))
     then s:=3 else s:=2;
   while (s<=i-1) and (a[s]>l) do
     begin
     a[f]:=a[s]; f:=s; s:=2*f;
     if ((s+1<=i-1) and (a[s+1]>a[s]))
         then s:=s+1;
     end;
   a[f]:=l;
  end;
end;
var
 s:ansistring; i,j,x,res,q,p,n:longint;
 a,b,dp,dp1:niz;
 begin
  read(n);
  for i:=1 to 8*8*2-1 do
   begin
   s:=binstr(i,7);
   for j:=1 to 7 do
   if s[j]='0' then  a[i]:=a[i]*10 else a[i]:=a[i]*10+1;
  end;

 sort (a,8*8*2-1);

  dp[0]:=0;

  for i:=1 to n do
  dp[i]:=maxlongint;

    for i:=1 to n do
    for j:=1 to 8*8*2-1 do
     begin
     if a[j]>i then break;
     if dp[i]>dp[i-a[j]]+1 then
      begin
      dp[i]:=dp[i-a[j]]+1;
      dp1[i]:=a[j];
     end;
  end;

 writeln(dp[n]);

 p:=n;
 for i:=1 to dp[n] do
  begin
  write(dp1[p],' ');
  p:=p-dp1[p];
 end;
end.

Uses
  Math;
Var
  n,l,st,mx,j,i:longint;
  r:array[1..7]of longint;
  an:array[1..9]of longint;
begin
//  assign(input,'input.txt');assign(output,'output.txt');
  readln(n);l:=0;mx:=0;
  while n<>0 do
    begin
      inc(l);
      r[l]:=n mod 10;
      mx:=max(mx,r[l]);
      n:=n div 10;
    end;
  writeln(mx);
  for i:=1 to mx do
    an[i]:=0;
  st:=1;
  for i:=1 to l do
    begin
      for j:=1 to r[i] do
        inc(an[j],st);
      st:=st*10;
    end;
  for i:=1 to mx do
    write(an[i],' ');
end.

var
l,i,j:longint;
a:string;
max:char;
s:array[1..10000] of integer;
begin
readln(a);
l:=1;
for i:=1 to length(a) do if(a[i]>max) then max:=a[i];
writeln(max);
for i:=length(a) downto 1 do
begin
for j:=1 to ord(a[i])-48 do s[j]:=s[j]+l;
l:=l*10;
end;
for i:=1 to ord(max)-48 do write(s[i],' ');
end.

var
    n, i, j, res, oo, jmax: longint;
    f, trace, val: array [0..1000100] of longint;
function check(k: longint): boolean;
var j: longint;
    s: string;
begin
	str(k, s);
	for j:=1 to length(s) do
		if ((s[j] <> '1') and (s[j] <> '0')) then exit(false);
	exit(true);
end;

procedure init;
begin
for i:=1 to n do
   if (check(i)) then
      begin
      inc(jmax);
      val[jmax] := i;
      end;
end;
begin
   read(n);
   oo := 2000000;
   init;
   for i:=1 to n do f[i] := oo;
   for i:=1 to n do
      for j:=1 to jmax do
         if (i >= val[j]) then
            if (f[i] > f[i-val[j]] + 1) then
               begin
               f[i] := f[i-val[j]] + 1;
               trace[i] := i - val[j];
               end;
   res := n;
   writeln(f[res]);
   while (f[res] <> 0) do
      begin
      write(res - trace[res], ' ');
      res := trace[res];
      end;
end.

var
  n,i,cnt:longint;
  t,s:string;
  a:array[0..100001] of longint;
begin
  read(n);
  while n>0 do begin
    str(n,s);
	t:='';
	for i:=1 to length(s) do if s[i]>'0' then begin t:=t+'1'; s[i]:=chr(ord(s[i])-1); end else t:=t+'0';
	inc(cnt); val(t,a[cnt]); val(s,n);
  end;
  writeln(cnt);
  for i:=1 to cnt do write(a[i],' ');
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  readln(n);
  qq[0]:=1;
  for i:=1 to 7 do qq[i]:=qq[i-1]*10;
  for i:=0 to 6 do cc[i]:=n mod qq[i+1] div qq[i];
  n:=0;
  for i:=0 to 6 do
    if cc[i]>n then n:=cc[i];
  writeln(n);
  for i:=1 to n do
    begin
    k:=0;
    for j:=0 to 6 do
      if cc[j]>0 then
        begin
        inc(k,qq[j]);
        dec(cc[j]);
        end;
    write(k,' ');
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

uses SysUtils,Math;
type mass=array[0..1000] of string;
var res,a,n,kol,NewKol:int64;
    i,z,j:longint;
    u:boolean;
    ch:char;
    m,m1:mass;
    s,s1:string;
begin
 //  assign(input,'input.txt');
 //  assign(output,'output.txt');
   readln(s);
   res:=0;
   for i:=1 to 100 do
      Begin
         u:=false;
         for z:=1 to length(s) do
            if s[z]<>'0'
            then Begin
                    inc(res);
                    u:=true;
                    break;
                 end;
         if u
         then Begin
                 m[res]:='';
                 for z:=1 to length(s) do
                    if s[z]<>'0'
                    then Begin
                            m[res]:=m[res]+'1';
                            s[z]:=pred(s[z]);
                         end
                    else m[res]:=m[res]+'0';
              end;
      end;
   writeln(res);
   for i:=1 to res do
      write(StrToInt(m[i]),' ');
end.

var s,s1,q,q1:string;i,j,m,k:longint;a,b:array[0..10]of longint;
begin
 READ(J);m:=0;
 for i:=1 to 7 do
 begin
  a[i]:=j mod 10;
  if a[i]>m then m:=a[i];
  j:=j div 10;
 end;
 writeln(m);
 for i:=1 to m do
 begin

 for j:=7 downto 1 do
 begin
   if a[j]>0 then k:=1 else k:=0; dec(a[j]);
   b[i]:=10*b[i]+k;
 end;
 end;

 for i:=1 to m do write(b[i],' ');
end.

program cfb;
var
  a:longint;
  b:array[1..100000] of longint;
  i,n,m,j,k,z,ma:longint;
procedure p(x:longint);
 var
   kk:longint;
 begin
      while (x>0) do
      begin
        inc(kk);
        x:=x div 10;
      end;
      n:=kk;
      end;
function s(x:longint):longint;
var
  i1,j1:longint;
begin
     j1:=1;
     for i1:=1 to x do
     j1:=j1*10;
     s:=j1;
end;
 begin
   read(a);
   P(a);
       z:=1;
       ma:=0;
   while a>0 do
   begin
   k:=a mod 10;
   for i:=1 to k do
   b[i]:=b[i]+z;
   z:=z*10;
   if k>ma then ma:=k;

   a:=a div 10;

   end;
   writeln(ma);
   for i:=1 to ma do
   write(b[i],' ');
 end.

Const Fi='';
      Fo='';
Procedure Main;
Var St:AnsiString;
    i,j,n,Cc,Res:Longint;
    A:Array[1..7]Of Integer;
  Begin
    Readln(St);
    n:=Length(St);
    Res:=0;
    For i:=1 to n do
      Begin
        Val(St[i],A[i]);
        If Res<A[i] then
          Res:=A[i];
      End;
    Writeln(Res);
    For i:=1 to Res do
      Begin
        Cc:=0;
        For j:=1 to n do
          If A[j]<>0 then
            Begin
              Cc:=Cc*10+1;
              Dec(A[j]);
            End
          Else
            Cc:=Cc*10;
        Write(Cc,' ');
      End;
  End;
Begin
  Assign(Input,Fi);Reset(Input);
  Assign(Output,Fo);Rewrite(Output);
  Main;
  Close(Input);Close(Output);
End.

var f1:text;nn,n,res,i,s:longint;
a:array[1..10000]of longint;
begin
        assign(f1,'');reset(f1);
        readln(f1,n);res:=0;
        while n<>0 do
        begin
                nn:=n;s:=1;
                while nn<>0 do
                begin if nn mod 10=0 then s:=s*10 else s:=s*10+1;nn:=nn div 10;end;
                nn:=s;s:=0;
                while nn>=10 do
                begin s:=s*10+(nn mod 10);nn:=nn div 10;end;
                inc(res);a[res]:=s;n:=n-s;
        end;
        writeln(res);
        for i:=1 to res do write(a[i],' ');
end.

var a,b:array[0..10000] of int64;
i,j:longint;n,t,max:int64;
begin
//assign(input,'zejz.in');reset(input);
//assign(output,'zejz.out');rewrite(output);
readln(n);
while n<>0 do
  begin
  t:=t+1;
  a[t]:=n mod 10;
  n:=n div 10;
  end;
for i:=t downto 1 do
  begin
  for j:=1 to a[i] do
    b[j]:=b[j]*10+1;
  for j:=a[i]+1 to 10 do
    b[j]:=b[j]*10;
  if a[i]>max then
    max:=a[i];
  end;
writeln(max);
for i:=max downto 1 do
  write(b[i],' ');
close(input);close(output);
end.

program quasibinary;
var     n,i,m:longint;
        t:array[1..1000000] of longint;

function divide(n:longint):longint;
var p:longint;
begin
    p:=1;
    while p<=n do
        p:=p*10;
    p:=p div 10;
    divide:=p;
end;

procedure subtract(var n:longint);
var
l,d,s:longint;
begin
    l:=0;
    s:=n;
    while s > 0 do
    begin
        d:=divide(s);
        l:=l+d;
        s:=s mod d;
    end;
    n:=n-l;
    inc(m);
    t[m]:=l;
end;

begin
    readln(n);
    m:=0;
    while n <> 0 do
        subtract(n);
    writeln(m);
    for i:=1 to m do
        write(t[i],' ');
end.

USES MATH;

{$COPERATORS ON}

VAR sum : longint;
    i,j,l,m : integer;
    s : string;
    n : array of shortint;

BEGIN
    readln(s);

    l := length(s);
    setlength(n,l);
    m := 0;
    for i := 1 to l do begin
        n[i-1] := byte(s[i]) - byte('0');
        if n[i-1] > m then
        m := n[i-1]
    end;

    writeln(m);
    for i := 1 to m do begin
        sum := 0;
        for j := 0 to l-1 do begin
            sum := 10*sum + min(n[j],1);
            n[j] := max(0,n[j]-1)
        end;
        write(sum,' ')
    end
END.

var i,n,ans,x,j:longint;
    flag:boolean;
    a,b,f:array[-1..1000010]of longint;
begin
	a[0]:=0;
	for i:=1 to 1000000 do
	begin
		x:=i;flag:=true;
		while x<>0 do
		begin
			if x mod 10>1 then flag:=false;
			x:=x div 10;
		end;
		if flag then
		begin
			inc(a[0]);
			a[a[0]]:=i;
		end;
	end;
	//writeln(a[0]);
	fillchar(b,sizeof(b),63);
	readln(n);b[0]:=0;
	for i:=1 to n do
		for j:=1 to a[0] do
		begin
			if i<a[j] then break;
			if b[i-a[j]]+1<b[i] then
			begin
				b[i]:=b[i-a[j]]+1;
				f[i]:=i-a[j];
			end;
		end;
	writeln(b[n]);
	while n<>0 do
	begin
		write(n-f[n],' ');
		n:=f[n];
	end;
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
x: array of integer;
s, h: string;
a,i,b, max, j, z: integer;
q: array [0..1000]  of longint;
begin
max:=0;
readln(s);
a:=length(s);
setlength(x, a);
  for i:= 1 to a do
  x[i-1]:=strtoint(s[i]);
z:=1;
q[0]:=0;
  for i:=0 to a-1 do
    if max<x[i] then max:=x[i];
  while   max<>0 do
    begin
      for i:=1 to a do
        begin
          if  (x[i-1]<>0) then
            begin
              q[z]:=round(power(10, a-i)) + q[z];
              x[i-1]:=x[i-1] - 1;
            end;
          end;
     z:=z+1;
     max:=max-1;
     end;

writeln(z-1);
for i:=1 to z-1 do
if i<>z-1 then
write(q[i], ' ')
else
write(q[i]);
readln;
end.

var
  a, b, c, i, max, j, t: int64;
  ar: array [1..1000] of int64;
  q: boolean;

begin
  readln(a);
  j := 1;
  max := 0;
  while a > 0 do begin
    if (a mod 10 > max) then max := a mod 10;
    ar[j] := a mod 10;
    inc(j);
    a := a div 10;
  end;
  writeln(max);
  i := 1;
  while i <= max do begin
    t := j - 1;
    q := false;
    while t > 0 do begin
      if (ar[t] > 0) then begin
        write(1);
        dec(ar[t]);
        q := true;
      end
      else if (q) then write(0);
      dec(t);
    end;
    write(' ');
    inc(i);
  end;
end.

uses sysutils;
var
	s1,s,sc: longint;
	n	: longint;
	a,k	: string;
	min,m	: integer;
        count   : integer;
        l       : ansistring;
begin
	readln(n);
	s:=1;
	s1:=1;
	while s<n do
	begin
		inc(s1);
		s:=s*10;
	end;
	if s>n then
	begin
		dec(s1);
		s:= s div 10;
	end;

	while n>0 do
	begin
                while s>n do
                begin
                        dec(s1);
                        s:=s div 10;
                end;
		a:=inttostr(n);
		k:='';
		min:=9;
		for sc:= 1 to s1 do
		begin
			if a[sc]='0' then k:=k+'0' else k:=k+ '1';
			if (strtoint(a[sc])<min) and (a[sc]<>'0') then min:= strtoint(a[sc]);
		end;
                inc(count,min);
		for m:= 1 to min-1 do
		begin
			l:=l+k+' ';
			n:=n-strtoint(k);

		end;
                l:=l+k;
                n:=n-strtoint(k);
		if n>0 then l:=L+' ';
	end;
	writeln(count);
        writeln(l);
end.

var
b:array[1..100] of integer;
i,c,n,s,a,t:integer;
begin
c:=1;
readln(n);
s:=n;
while(n>0)do
begin
a:=n mod 10;
for i:=1 to a do
b[i]:=b[i]+c;
if(a>t)then t:=a;
c:=c*10;
n:=n div 10;
a:=0;
end;
writeln(t);
for i:=t downto 1 do
begin
write(b[i]);
write(' ');
end;
readln;
end.

var
  m:array[1..1000000]of longint;
  a:array[1..10]of longint;
  n,t,s,i,p,q:longint;
begin
  readln(n);
  t:=0;
  while n>0 do
    begin
      inc(t);
      a[t]:=n mod 10;
      n:=n div 10;
    end;
  s:=0;
  while t>0 do
    begin
      p:=0;
      q:=0;
      for i:=t downto 1 do
        if a[i]>0 then
          begin
            dec(a[i]);
            p:=p*10+1;
            if(a[i]>0)and(i>q)then q:=i;
          end
                  else
          p:=p*10;
      inc(s);
      m[s]:=p;
      t:=q;
    end;
  writeln(s);
  for i:=1 to s do
    write(m[i],' ');
end.

var b:array[1..100] of longint;
    i,c,n,s,a,t:longint;
begin
readln(n);
s:=n;
c:=1;
while(n>0)do
 begin
  a:=n mod 10;
  for i:=1 to a do
   b[i]:=b[i]+c;
  if(a>t)then t:=a;
  c:=c*10;
  n:=n div 10;
  a:=0;
 end;

writeln(t);

for i:=1 to t do
  write(b[i],' ');
end.

var i,j,n,m,f,q,k,max,l:longint;
    a:array [1..9] of longint;
begin
 read (n);
 k:=1;
 while n>0 do
  begin
   l:=n mod 10;
   for i:=1 to l do
    a[i]:=a[i]+1*k;
   k:=k*10;
   if l>max then max:=l;
   n:=n div 10;
  end;
 writeln (max);
 for i:=1 to max do
  write (a[i],' ');
end.

const
 mo=1000000007;
var
 a:array[1..11111] of longint;
 n,m,k,x,q,w,e,sum,l,r,xx,yy:int64;i,z,j:longint;
 s,cf:string;
function min(x,y:int64):int64;
begin if x<y then min:=x else min:=y;end;

function max(x,y:int64):int64;
begin if x>y then max:=x else max:=y;end;

begin
 readln(s);
 n:=length(s);
 for i:=1 to n do a[i]:=ord(s[i])-48;
 for i:=1 to n do if ord(s[i])-48>m then m:=ord(s[i])-48;
 writeln(m);
 for i:=1 to m do
 begin
  z:=1;
  while a[z]=0 do inc(z);
  for j:=z to n do
  begin if a[j]>0 then begin write('1');dec(a[j]);end else write('0');end;
  write(' ');
 end;
end.

program PB;
var
  n,i,max,sum,j,m:longint;
  a:array[0..9] of longint;

begin
  readln(n);
  while n>0 do
  begin
    inc(sum);
    a[sum]:=n mod 10;
    n:=n div 10;
  end;
  for i:=1 to sum do
    if max<a[i] then max:=a[i];
  writeln(max);
  m:=sum;
  for i:=max downto 1 do
  begin
    for j:=m downto 1 do
    begin
      if a[j]>0 then
      begin
        write(1);
        dec(a[j]);
      end
      else write(0);
      while (a[m]=0) and (m>0) do dec(m);
    end;
    write(' ');
  end;
end.

program yan;
  var ar:array[1..7]of longint;
      an:array[1..1000]of longint;
      i,j,x,y,a,b,n,m:longint;
  function prov:boolean;
    var i,j:longint;
    begin
      for i:=1 to n do
        if ar[i]<>0 then exit(true);
      exit(false);
    end;
begin
  read(n);
  while n<>0 do
    begin
      x:=n mod 10;
      inc(i); ar[i]:=x;
      n:=n div 10;
    end;
  n:=i;
  while prov do
    begin
      y:=0; inc(b);
      for i:=n downto 1 do
        begin
          if ar[i]>0 then
            begin
              y:=1; an[b]:=an[b]*10+1;
              dec(ar[i]);
            end else if y=1 then an[b]:=an[b]*10;
        end;
    end;
  writeln(b);
  for i:=1 to b do
    write(an[i],' ');
end.

type
        arr     =array[1..6] of longint;

var
        N       :longint;
        res     :array[0..1000000] of longint;
        sl      :array[0..1000000] of longint;
        dem     :longint;
        x       :arr;
        x1      :arr;

procedure       tach(var x:arr);
var     mi,ma,i:longint;xx:longint;mul:longint;
Begin
        mi:=10;
        ma:=-1;
        mul:=1;
        xx:=0;
        for i:=N downto 1 do
                Begin
                    if x[i]>ma then ma:=x[i];
                    if (x[i]<mi) and (x[i]>0) then mi:=x[i];
                end;
        if ma=1 then
                begin
                    for i:=1 to N do
                        begin
                            xx:=xx+x[i]*mul;
                            mul:=mul*10;
                            x[i]:=0;
                        end;
                end;
        inc(dem);
        sl[dem]:=mi;
        for i:=1 to N do
              if x[i]>0 then
                 Begin
                     xx:=xx+mul;
                     mul:=mul*10;
                 end
              else
                     mul:=mul*10;
        res[dem]:=xx;
        for i:=1 to n do
              if x[i]>0 then
                    x[i]:=x[i]-mi;
end;

function        check:boolean;
var     i:longint;
Begin
        for i:=1 to N do
                if x[i]>1 then exit(false);
        exit(true);
end;

procedure       xuli;
var     i,j,xx,mul:longint;ok:boolean;
Begin
        readln(xx);
        N:=0;
        while xx>0 do
                Begin
                    inc(N);
                    x[N]:=xx mod 10;
                    xx:=xx div 10;
                end;
        dem:=0;
        fillchar(sl,sizeof(sl),0);
        while check=false do tach(x);
        ok:=false;
        for i:=n downto 1 do
              if x[i]>0 then
               begin
                        N:=i;
                        break;
               end;
        mul:=1;
        xx:=0;
        for i:=1 to N do
              if x[i]>0 then
                begin
                    xx:=xx+mul;
                    mul:=mul*10;
                end
              else mul:=mul*10;
        if xx>0 then
                begin
                    inc(dem);
                    sl[dem]:=1;
                    res[dem]:=xx;
                end;
        xx:=0;
        for i:=1 to dem do
                xx:=xx+sl[i];
        writeln(xx);
        for i:=1 to dem do
                for j:=1 to sl[i] do
                        write(res[i],' ');
end;

BEGIN
        xuli;
END.

Var b:array[1..100] of longint;
    i,c,n,s,a,t:longint;
begin
readln(n);
s:=n;
c:=1;
while(n>0)do
 begin
  a:=n mod 10;
  for i:=1 to a do
   b[i]:=b[i]+c;
  if(a>t)then t:=a;
  c:=c*10;
  n:=n div 10;
  a:=0;
 end;

writeln(t);

for i:=1 to t do
  write(b[i],' ');
end.

Program Main;

  Type TMem = record
    MinCount : LongInt;
    LastDigit : LongInt;
  end;

  var Memory : Array [ 0 .. 2000000 ] of TMem;
      Q : Array [ 1 .. 2000000 ] of LongInt;
      QHead : LongInt;

      Moves : Array [ 1 .. 100000 ] of LongInt;
      MovesCount : LongInt;

  Function Dva ( I : LongInt ) : Boolean;
    var S : String;
        j : LongInt;
  begin
    STR ( I , S ) ;
    for j := 1 to Length(S) do
      if ( S[j] <> '1' ) and ( S[j] <> '0' ) then
        exit ( false ) ;

    Dva := true;
  end;

  Procedure Add ( I , N : LongInt ) ;
    var x : LongInt;
        cDist : LongInt;
  begin
    cDist := Q[i];
    for x := 1 to MovesCount do
    begin
      if ( Memory[cDist+Moves[x]].MinCount = 0 ) then
      begin
        if ( cDist + Moves[x] <= N ) then
        begin
          Memory[cDist+Moves[x]].MinCount := Memory[cDist].MinCount+1;
          Memory[cDist+Moves[x]].LastDigit := Moves[x];
          inc ( QHead ) ;
          Q[QHead] := cDist+Moves[x];
        end;
      end;
    end;
  end;

  Procedure AddMoves ( N : LongInt ) ;
    var I : LongInt;
  begin
    MovesCount := 0;
    for i := 1 to N do
      if ( Dva(I) ) then
      begin
        inc ( MovesCount ) ;
        Moves[MovesCount] := I;
      end;
  end;

  var N , I : LongInt;
begin
  readLn ( N ) ;

  AddMoves ( N ) ;

  QHead := 1 ;
  Q[1] := 0;
  I := 1;
  while ( I <= QHead ) do
  begin
    add ( i , n ) ;
    inc ( i ) ;
  end;

  I := N;
  writeLn ( Memory [ N ].MinCount ) ;

  while ( I <> 0 ) do
  begin
    if ( Memory[I].LastDigit <> 0 ) then
      write(Memory[I].LastDigit , ' ');
    I := I-Memory[i].LastDigit;
  end;

end.

const finp='';
      fout='';
var s:string;
procedure nhap;
var f:Text;
begin
    assign(f,finp); reset(f);
    read(f,s);
    close(f);
end;
function findmin:byte;
var i,min:byte;
begin
    min:=10;
    for i:=1 to length(s) do
        if ((ord(s[i])-48)<min) and (s[i]<>'0') then
            min:=ord(s[i])-48;
    findmin:=min;
end;
function construct_max:string;
var i:byte;
    s1:string;
begin
    s1:='';
    for i:=1 to length(s) do
        if s[i]<>'0' then
            s1:=s1+'1'
        else
            s1:=s1+'0';
    while s1[1]='0' do
        delete(s1,1,1);
    construct_max:=s1;
end;
procedure minus(k:byte);
var i:byte;
begin
    for i:=1 to length(s) do
        if s[i]<>'0' then
            s[i]:=chr(ord(s[i])-k);
end;
procedure xuat;
var f:Text;
    i,d,min:byte;
    comp,maxquasi:string;
    a:array[1..100] of string;
begin
    assign(f,fout); rewrite(f);
    comp:=''; d:=0;
    for i:=1 to length(s) do
        comp:=comp+'0';
    while s<>comp do
        begin
            min:=findmin;
            maxquasi:=construct_max;
            i:=1;
            while i<=min do
                begin
                    inc(d); inc(i);
                    a[d]:=maxquasi;
                end;
            minus(min);
        end;
    writeln(f,d);
    for i:=1 to d do
        write(f,a[i],' ');
    close(f);
end;
begin
    nhap;
    xuat;
end.

var
 ff:array[1..1000]of longint;
 f:array[1..100,1..100]of longint;
 s,t:ansistring;
 ffff,k,h,i,j,n:longint;
begin
 readln(n);
 str(n,s);
 for i:=1 to length(s) do
 begin
  for j:=1 to ord(s[i])-48 do
  begin
   inc(f[i,j]);
   ff[j]:=1;
  end;
 end;
 for i:=9 downto 1 do if ff[i]=1 then
 begin
  n:=i;
  break;
 end;
 writeln(n);
 for i:=1 to n do
 begin
  t:='';
  ffff:=0;
  for j:=1 to length(s) do
  begin
   if (f[j,i]=0)and(ffff=0) then continue;
   ffff:=1;
   t:=t+chr(f[j,i]+48);
  end;
  write(t,' ');

 end;
end.

var s:string;
    ans:array[1..100] of string;
    b:boolean;
    i,k,n,m,j:longint;
begin
readln(s);

b:=true;
while  b do
begin
 b:=false;
 inc(n);
 for i:=1 to length(s) do
  if s[i]='0'
  then ans[n]:=ans[n]+s[i]
  else begin
   b:=true;
   ans[n]:=ans[n]+'1';
   s[i]:=chr(ord(s[i])-1);
  end;
end;
writeln(n-1);
for i:=1 to n-1 do
begin
 k:=1;
 while ans[i,k]='0' do
  inc(k);
 for j:=k to length(ans[i]) do
  write(ans[i,j]);
  write(' ');
end;

end.

Const Fi='';
      Fo='';
Procedure Main;
Var St:AnsiString;
    i,j,n,Cc,Res:Longint;
    A:Array[1..7]Of Integer;
  Begin
    Readln(St);
    n:=Length(St);
    Res:=0;
    For i:=1 to n do
      Begin
        Val(St[i],A[i]);
        If Res<A[i] then
          Res:=A[i];
      End;
    Writeln(Res);
    For i:=1 to Res do
      Begin
        Cc:=0;
        For j:=1 to n do
          If A[j]<>0 then
            Begin
              Cc:=Cc*10+1;
              Dec(A[j]);
            End
          Else
            Cc:=Cc*10;
        Write(Cc,' ');
      End;
  End;
Begin
  Assign(Input,Fi);Reset(Input);
  Assign(Output,Fo);Rewrite(Output);
  Main;
  Close(Input);Close(Output);
End.

uses math;
var s,n,i,smax,k:longint;
    a:array[1..1000] of longint;

procedure swap(var a,b:longint);
var t:longint;
begin
    t:=a;
    a:=b;
    b:=t;
end;

begin
    readln(s);
    while s>0 do
    begin
        n:=n+1;
        a[n]:=s mod 10;
        smax:=max(smax,a[n]);
        s:=s div 10;
    end;
    for i:=1 to n div 2 do
        swap(a[i],a[n-i+1]);
    writeln(smax);
    for k:=1 to smax do
    begin
        s:=0;
        for i:=1 to n do
            if a[i]>0 then
            begin
                s:=s*10+1;
                dec(a[i]);
            end
            else s:=s*10;
        write(s,' ');
    end;
end.

uses math,sysutils;
var i,p,l,k,j,m,n,imain,t,x1,x2,y1,y2,jmain,u,y,len,l1,l2,r1,r2:longint;
    a,b,c:array[0..1000]of int64;
    s:string;

procedure io;
var i:longint;
begin
    for i:=1 to m do
    begin
        a[i]:=strtoint(inttostr(n)[i]);
        b[i]:=0;
    end;
end;

begin
    read(n);
    while n<>0 do
    begin
        m:=length(inttostr(n));
        io;
        for i:=1 to m do
        begin
            if a[i]>1 then
                b[i]:=1
            else
                b[i]:=a[i];
        end;
        k:=0;
        for i:=1 to m do
        begin
            k:=k+b[i]*round(power(10,m-i));
        end;
        n:=n-k;
        inc(t);
        c[t]:=k;
    end;
    writeln(t);
    for i:=1 to t do
        write(c[i],' ');
end.

program z1;
  var n,m,i,j,l,k,c,h:int64;
  a,d:array [1..10] of int64;
  b:array [1..10,1..10000] of int64;
  begin
    readln(n);
    while n<>0 do begin
      l := l+1;
      d[l]:=n mod 10;
      n:=n div 10;
    end;
    for i:=1 to l do a[i]:=d[l-(i-1)];
    i:=0;
    while k<>1 do begin
      c:=0;
      j := j+1;
      for i:=1 to l do begin
        if a[i]>=1 then begin
          a[i]:=a[i]-1;
          b[i,j]:=1;
        end
      end;
      for i:=1 to l do if a[i]<>0 then c:=1;
      if c=0 then break;
    end;
    writeln(j);
    for i:=1 to j do begin
      c:=0;
      for h:=1 to l do begin
        if b[h,i]<>0 then c:=1;
        if c=1 then write(b[h,i]);
      end;
      write(' ');
    end;
  end.

program quasibinary;
var     n,i,m:longint;
        t:array[1..1000000] of longint;

function divide(n:longint):longint;
var p:longint;
begin
    p:=1;
    while p<=n do
        p:=p*10;
    p:=p div 10;
    divide:=p;
end;

procedure subtract(var n:longint);
var
l,d,s:longint;
begin
    l:=0;
    s:=n;
    while s > 0 do
    begin
        d:=divide(s);
        l:=l+d;
        s:=s mod d;
    end;
    n:=n-l;
    inc(m);
    t[m]:=l;
end;

begin
    readln(n);
    m:=0;
    while n <> 0 do
        subtract(n);
    writeln(m);
    for i:=1 to m do
        write(t[i],' ');
end.

var a:array[1..100] of longint;
    i,c,n,b,t:longint;
    begin
    readln(n);
    c:=1; t:=0;
    while n>0 do
      begin
      b:=n mod 10;
      for i:=1 to b do
        a[i]:=a[i]+c;
      if b>t then t:=b;
      c:=c*10;
      n:=n div 10;
      b:=0;
      end;
    writeln(t);
    for i:=1 to t do
      write(a[i],' ');
    end.

var
  n,i,j,tot,ans:longint;
  ansq:array[1..100000] of longint;
  que:array[1..1000000] of longint;
  q:array[1..100000] of longint;
  f,pre:array[0..1000000] of longint;

procedure judge(t:longint);
var
  tmp:longint;
begin
  tmp:=t;
  while t>0 do
  begin
    if (t mod 10<>0) and (t mod 10<>1) then exit;
    t:=t div 10;
  end;
  inc(tot); que[tot]:=tmp;
end;

procedure dp;
var
  i,j,t:longint;
begin
  fillchar(f,sizeof(f),100); f[0]:=0;
  for i:=0 to n-1 do
    if f[i]+1<f[n] then
    for j:=1 to tot do
      if (i+que[j]<=n) and (f[i+que[j]]>f[i]+1) then
      begin
        f[i+que[j]]:=f[i]+1;
        pre[i+que[j]]:=i;
      end;
  writeln(f[n]); t:=n;
  while t>0 do
  begin
    write(t-pre[t],' ');
    t:=pre[t];
  end;
  writeln;
end;

begin
  readln(n); ans:=n+1;
  for i:=n downto 1 do judge(i);
  dp;
end.

var
l,i,j:longint;
a:string;
max:char;
s:array[1..10000] of integer;
begin
readln(a);
l:=1;
for i:=1 to length(a) do if(a[i]>max) then max:=a[i];
writeln(max);
for i:=length(a) downto 1 do
begin
for j:=1 to ord(a[i])-48 do s[j]:=s[j]+l;
l:=l*10;
end;
for i:=1 to ord(max)-48 do write(s[i],' ');
end.

var
  a, b, c, i, max, j, t: int64;
  ar: array [1..1000] of int64;
  q: boolean;

begin
  readln(a);
  j := 1;
  max := 0;
  while a > 0 do begin
    if (a mod 10 > max) then max := a mod 10;
    ar[j] := a mod 10;
    inc(j);
    a := a div 10;
  end;
  writeln(max);
  i := 1;
  while i <= max do begin
    t := j - 1;
    q := false;
    while t > 0 do begin
      if (ar[t] > 0) then begin
        write(1);
        dec(ar[t]);
        q := true;
      end
      else if (q) then write(0);
      dec(t);
    end;
    write(' ');
    inc(i);
  end;
end.

var n,i,s,x,k:longint;
    a,c:array[1..7]of longint;
    b:array[1..100000]of longint;
begin
  read(n); s:=n;
  c[7]:=1;
  for i:=7 downto 1 do
  begin
    if i<7 then c[i]:=c[i+1]*10;
    a[i]:=n mod 10;
    n:=n div 10
  end;
  n:=0; x:=1;
  while s>0 do
  begin
    x:=0;
    for i:=1 to 7 do
      if a[i]>0 then begin dec(a[i]); x:=x+c[i] end;
    inc(n); b[n]:=x;
    s:=s-x
  end;
  writeln(n);
  for i:=1 to n do write(b[i],' ')
end.

var b:array[1..100] of longint;
    i,c,n,s,a,t:longint;
begin
readln(n);
s:=n;
c:=1;
while(n>0)do
 begin
  a:=n mod 10;
  for i:=1 to a do
   b[i]:=b[i]+c;
  if(a>t)then t:=a;
  c:=c*10;
  n:=n div 10;
  a:=0;
 end;

writeln(t);

for i:=1 to t do
  write(b[i],' ');
end.

var
  n,i,cnt:longint;
  t,s:string;
  a:array[0..100001] of longint;
begin
  read(n);
  while n>0 do begin
    str(n,s);
	t:='';
	for i:=1 to length(s) do if s[i]>'0' then begin t:=t+'1'; s[i]:=chr(ord(s[i])-1); end else t:=t+'0';
	inc(cnt); val(t,a[cnt]); val(s,n);
  end;
  writeln(cnt);
  for i:=1 to cnt do write(a[i],' ');
end.

program CF300B;
var a,b,c,d,i,n,j,k:longint; Z:array[1..100000] of longint;
s,s1:string;
begin
{assign(input,'d:\FPC\input.txt');
reset(input);
assign(output,'d:\FPC\output.txt');
rewrite(output);}
read(s);
a:=length(s);
while a>1 do
begin
for i:=1 to a do
 if ord(s[i])>48 then
  begin
  s[i]:=chr(ord(s[i])-1);
  s1:=s1+'1';
  end
   else s1:=s1+'0';
s1:=s1+' ';
if s[1]='0' then
begin
while s[1]='0' do begin
for i:=2 to a do
s[i-1]:=s[i];
a:=a-1;
if a=1 then break;
end; end;
if a=1 then break;
end;
for i:=1 to length(s1) do
if s1[i]=' ' then k:=k+1;
k:=k+ord(s[1])-48;
writeln(k);
write(s1);
for i:=1 to ord(s[1])-48 do
write(1,' ');
end.

program PB;
var
  n,i,max,sum,j,m:longint;
  a:array[0..9] of longint;

begin
  readln(n);
  while n>0 do
  begin
    inc(sum);
    a[sum]:=n mod 10;
    n:=n div 10;
  end;
  for i:=1 to sum do
    if max<a[i] then max:=a[i];
  writeln(max);
  m:=sum;
  for i:=max downto 1 do
  begin
    for j:=m downto 1 do
    begin
      if a[j]>0 then
      begin
        write(1);
        dec(a[j]);
      end
      else write(0);
      while (a[m]=0) and (m>0) do dec(m);
    end;
    write(' ');
  end;
end.

program Contest300_B;
uses math;
const
        maxN=trunc(106);
var
        ff: text;
        n: longint;
        T,v,S: array[0..7] of longint;
        i,j,tmp,m,c: longint;

procedure swap(var a,b: longint);
  var   t: longint;
  begin
        t:=a;a:=b;b:=t;
  end;

begin
        readln(n);
        i:=0;
        while n<>0 do
          begin
                inc(i);
                T[i]:=n mod 10;
                v[i]:=i;
                S[i]:=max(1,S[i-1]*10);
                n:=n div 10;
          end;
        m:=i;
        for i:=1 to m do
          begin
           tmp:=i;
           for j:=i+1 to m do
                if (T[j]>T[tmp])  then tmp:=j;
           Swap(T[i],T[tmp]);
           Swap(v[i],v[tmp]);
          end;
        //for i:=1 to m do writeln(T[i],' ',v[i]);readln;
        writeln(T[1]);
        tmp:=0;
        i:=1;
        while true do
        begin
                j:=i;
             repeat
                        i:=j;
                        tmp:=tmp+S[ v[j] ];
                        if (j<m)and(T[i]=T[j+1]) then inc(j);
             until      (i=j)or(i=m);
             for c:=T[j+1]+1 to T[i] do write(tmp,#32);
             i:=j+1;
             if (j=m)or((j<m)and(T[j+1]=0)) then break;
        end;
        readln;
end.

var
 s:string;
 st:array[1..1000]of string;
 n,m,k,l,w,j,i,k1,p:longint;
 f:array[1..100000]of longint;
begin
 readln(n);
 m:=n;
 while m<>0 do
 begin
  inc(k);
  f[k]:=m mod 10;
  inc(k1,m mod 10);
  m:=m div 10;
 end;
 while k1<>0 do
 begin
  s:='';
  for i:=k downto 1 do
  begin
   if f[i]<>0 then begin s:=s+'1'; dec(f[i]); dec(k1); end else s:=s+'0';
  end;
  inc(w);
  p:=0;
  for i:=1 to length(s) do if s[i]='0' then inc(p) else break;
  delete(s,1,p);
  st[w]:=s;
 end;
 writeln(w);
 for i:=1 to w do write(st[i],' ');
end.

Uses
  Math;
Var
  n,l,st,mx,j,i:longint;
  r:array[1..7]of longint;
  an:array[1..9]of longint;
begin
//  assign(input,'input.txt');assign(output,'output.txt');
  readln(n);l:=0;mx:=0;
  while n<>0 do
    begin
      inc(l);
      r[l]:=n mod 10;
      mx:=max(mx,r[l]);
      n:=n div 10;
    end;
  writeln(mx);
  for i:=1 to mx do
    an[i]:=0;
  st:=1;
  for i:=1 to l do
    begin
      for j:=1 to r[i] do
        inc(an[j],st);
      st:=st*10;
    end;
  for i:=1 to mx do
    write(an[i],' ');
end.

uses    math;
const   fi='';
        fo='';
var     x:longint;
        i,j,res,k,dem,ma:longint;
        a,b:array[1..9] of byte;
        s:string;
procedure swap(var x,y:byte);
var     tg:byte;
begin
        tg:=x;x:=y;y:=tg;
end;
procedure init;
begin
    dem:=0;
    while x<>0 do
        begin
            inc(dem);
            a[dem]:=x mod 10;
            x:=x div 10;
        end;

    for i:=1 to dem div 2 do
        swap(a[i],a[dem-i+1]);

    ma:=a[1];
    for i:=2 to dem do ma:=max(ma,a[i]);
    for i:=1 to dem do
        b[i]:=a[i];
end;

begin
        assign(input,fi);reset(input);
        assign(output,fo);rewrite(output);

        readln(x);

        init;

        for i:=1 to ma do
        begin
        s:='';
        for j:=1 to dem do
        if a[j]>0 then
        begin
            s:=s+'1';
            dec(a[j]);
        end else s:=s+'0';
        while s[1]='0' do delete(s,1,1);
        inc(res);
        end;
        writeln(res);

        for i:=1 to ma do
        begin
        s:='';
        for j:=1 to dem do
        if b[j]>0 then
        begin
            s:=s+'1';
            dec(b[j]);
        end else s:=s+'0';
        while s[1]='0' do delete(s,1,1);
        write(s,' ');
        end;
        close(input);close(output);
end.

var
  n,k,m,q,w,x,i,j,e,p :longint;
 a,b:array[0..200000]of longint;
 s:string;
begin

//assign(input,'input.txt');
//reset(input);
//assign(output,'output.txt');
//rewrite(output);
read(n);
while n>0 do
  begin
    i:=i+1;
    b[i]:=n mod 10;
    if b[i]>x then x:=b[i];
    n:=n div 10;
  end;
p:=i;
for i:=i downto 1 do
  begin
    e:=e+1;
    a[e]:=b[i];

  end;
writeln(x);

i:=p;
while x>0 do
  begin
    for j:=1 to i do
      if a[j]=x then
        begin
          s:=s+'1';
          a[j]:=a[j]-1;
        end
      else if length(s)>0 then s:=s+'0';
    x:=x-1;
    write(s,' ');
    s:='';

  end;

  end.

var r,max,n,i,j,tek:longint;
    a:Array[1..1000]of longint;
    fl:boolean;
begin
 read(n);
 while n>0 do
  begin
   inc(tek);
   a[tek]:= n mod 10;
   n:=n div 10;
  end;
 for i:=1 to tek div 2 do
  begin
  r:=a[i];
  a[i]:=a[tek-i+1];
  a[tek-i+1]:=r;
 end;
 for i:=1 to tek do
  if max<a[i]
   then max:=a[i];
 writeln(max);
 for i:=1 to max do
  begin
   fl:=false;
   for j:=1 to tek do
    if a[j]>0
     then begin dec(a[j]);
                write(1);
                fl:=true;
          end
     else if fl=true
           then write(0);
   write(' ');
  end;

end.

const	fi='';
	fo='';
var	f,g:Text;
	a:array[0..7] of integer;
	kq:array[0..20] of longint;
	n,i,t,heso,dem:longint;
	n2:ansistring;
	function check:boolean;
	var	i:longint;
		begin
			for i:=1 to length(n2) do
				if a[i]>0 then exit(true);
			exit(False);
		end;
begin
	assign(F,fi);
	reset(f);
	assign(g,fo);
	rewrite(g);
	readln(f,n);
	str(n,n2);
	for i:=1 to length(n2) do
	begin
		a[i]:=n mod 10;
		n:=n div 10;
	end;
	dem:=0;
	while check do
	begin
		heso:=1;
		t:=0;
		for i:=1 to length(n2) do
		begin
			if a[i]>0 then t:=t+heso;
			dec(a[i]);
			heso:=heso*10;
		end;
		inc(dem);
		kq[dem]:=t;
	end;
	writeln(g,dem);
	for i:=1 to dem do
		write(g,kq[i],' ');
	close(f);
	close(g);
end.

program cf538B;
var n,i,j,b:longint;
    a,c:array[1..100000] of longint;
begin
read(n);
while n>0 do
        begin
        inc(i);
        a[i]:=n mod 10;
        n:=n div 10;
        end;
n:=i;
b:=1;
while b<>0 do
        begin
        b:=0;
        for i:=n downto 1 do
                if a[i]>0 then
                        begin
                        b:=b*10+1;
                        dec(a[i]);
                        end
                else
                        b:=b*10;
        if b=0 then
                break;
        inc(j);
        c[j]:=b;
        end;

writeln(j);
for i:=1 to j do
        write(c[i],' ');
writeln;
end.

USES MATH;

{$COPERATORS ON}

VAR sum : longint;
    i,j,l,m : integer;
    s : string;
    n : array of shortint;

BEGIN
    readln(s);

    l := length(s);
    setlength(n,l);
    m := 0;
    for i := 1 to l do begin
        n[i-1] := byte(s[i]) - byte('0');
        if n[i-1] > m then
        m := n[i-1]
    end;

    writeln(m);
    for i := 1 to m do begin
        sum := 0;
        for j := 0 to l-1 do begin
            sum := 10*sum + min(n[j],1);
            n[j] := max(0,n[j]-1)
        end;
        write(sum,' ')
    end
END.

Var b:array[1..100] of longint;
    i,c,n,s,a,t:longint;
begin
readln(n);
s:=n;
c:=1;
while(n>0)do
 begin
  a:=n mod 10;
  for i:=1 to a do
   b[i]:=b[i]+c;
  if(a>t)then t:=a;
  c:=c*10;
  n:=n div 10;
  a:=0;
 end;

writeln(t);

for i:=1 to t do
  write(b[i],' ');
end.

Const Fi='';
      Fo='';
Procedure Main;
Var St:AnsiString;
    i,j,n,Cc,Res:Longint;
    A:Array[1..7]Of Integer;
  Begin
    Readln(St);
    n:=Length(St);
    Res:=0;
    For i:=1 to n do
      Begin
        Val(St[i],A[i]);
        If Res<A[i] then
          Res:=A[i];
      End;
    Writeln(Res);
    For i:=1 to Res do
      Begin
        Cc:=0;
        For j:=1 to n do
          If A[j]<>0 then
            Begin
              Cc:=Cc*10+1;
              Dec(A[j]);
            End
          Else
            Cc:=Cc*10;
        Write(Cc,' ');
      End;
  End;
Begin
  Assign(Input,Fi);Reset(Input);
  Assign(Output,Fo);Rewrite(Output);
  Main;
  Close(Input);Close(Output);
End.

program quazyBinary;

uses
  SysUtils;

var

n: integer;

procedure maxsubtr(var n : integer);
var
  i, counter : integer;
  ns : string;
  curs : string;
  curC : char;
  res : string;
begin
  ns := intToStr(n);

  counter := 0;
  while (n >0) do
  begin
    setlength(curS, length(ns));
    curC := ns[1];
    for i := 1 to length(ns) do
      if ns[i] < curC then
      begin
        curs[i] := '0';
      end else
        curS[i] := '1';
      res := res  + curS + ' ';
    n := n - StrToInt(curS);
    ns := IntToStr(n);
    counter := counter + 1;
  end ;
  writeln(intToStr(counter));
  writeln(res);

end;

begin
  readln(n);
  //n := 32;
  maxsubtr(n);
  //readln;

end.

var s:array[1..10] of string;
    n:string;
    i,k,l,j:integer;

procedure decall;
var i:longint;
begin
for i:=1 to l do
 dec(n[i]);
end;

begin
readln(n);
l:=length(n);

for i:=1 to 9 do
 begin
  for j:=1 to l do
   if n[j] > '0'
    then s[i]:=s[i]+'1'
    else s[i]:=s[i]+'0';
  decall;
  while (length(s[i])>0)and (s[i][1] = '0') do delete(s[i],1,1);
  if s[i] <> '' then inc(k);
 end;

 writeln(k);
 for i:=1 to k do
  write(s[i],' ');
end.

const
    finp = '';
    maxN = 1000010;
    inf = 1000000000;

var
    fi : text;
    n,nA : longint;
    a : array[0..2 shl 6] of longint;
    f,trace,res : array[0..maxN] of longint;

procedure init;
begin
    assign(fi,finp); reset(fi);
    read(fi,n);
    close(fi);
end;

function check(x:longint):boolean;
begin
    while x>0 do
    begin
        if x mod 10 > 1 then exit(false);
        x:=x div 10;
    end;
    exit(true);
end;

procedure process;
var
    i,j,p,num : longint;
begin
    for i:=1 to n do
    if check(i) then
    begin
        inc(nA);
        a[nA]:=i;
    end;

    for i:=1 to n do f[i]:=inf;

    for i:=1 to n do
    for j:=1 to nA do
    if (i>=a[j]) and (f[i-a[j]]+1<f[i]) then
    begin
        f[i]:=f[i-a[j]]+1;
        trace[i]:=a[j];
    end;

    writeln(f[n]);
    p:=n;
    while p>0 do
    begin
        write(trace[p],' ');
        p:=p-trace[p];
    end;
end;

begin
    init;
    process;
end.

var n,x,m,i:longint;
a:array[0..100] of longint;
begin
//assign(output,'zejz.out');rewrite(output);
readln(n);
x:=1;
while n>0 do
  begin
  for i:=1 to n mod 10 do a[i]:=a[i]+x;
  if n mod 10>m then m:=n mod 10;
  n:=n div 10;x:=x*10;
  end;
writeln(m);
for i:=1 to m do write(a[i],' ');
close(input);close(output);
end.

var i,j,n,m,f,q,k,max,l:longint;
    a:array [1..9] of longint;
begin
 read (n);
 k:=1;
 while n>0 do
  begin
   l:=n mod 10;
   for i:=1 to l do
    a[i]:=a[i]+1*k;
   k:=k*10;
   if l>max then max:=l;
   n:=n div 10;
  end;
 writeln (max);
 for i:=1 to max do
  write (a[i],' ');
end.

var
  l, k: integer;
  n,i: longint;
  min, max, pos0: byte;
  found0: boolean;

function len(a: longint): integer;
var
  k: integer;
begin
  min := 10;
  max := 0;
  found0 := false;
  k := 0;
  while a > 0 do
  begin
    if a mod 10 = 0 then
    begin
      found0 := true;
      pos0 := k + 1;
    end
    else if (a mod 10 < min) then
      min := a mod 10;
    if (a mod 10 > max) then
      max := a mod 10;
    a := a div 10;
    inc(k);
  end;
  len := k;
end;

function pow10(a: byte): longint;
var
  k: longint;
  i: byte;
begin
  k := 1;
  for i := a downto 1 do
    k := k * 10;
  pow10 := k;
end;

function get11(a: byte): longint;
var
  k,n2: longint;
  i,j: byte;
begin
  k := 0;
  for i := a downto 1 do
  begin
    n2 := n;
    k := k * 10;
    for j := 1 to i-1 do
      n2 := n2 div 10;
    if n2 mod 10 <> 0 then
      inc(k);
  end;
  get11 := k;
end;

begin
  readln(N);

  l := len(n);
  writeln(max);
  k := get11(l);
  for i := 1 to min do
  begin
    n := n - k;
    write(k, ' ');
  end;

  while n > 0 do
  begin
    l := len(n);
    k := get11(l);
    for i := 1 to min do
    begin
      n := n - k;
      write(k, ' ');
    end;
  end;
end.

program zad_A;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
    a, d, b :array[1..123456] of integer;
    n, kol, i, j, sum, w, u, k :integer;

begin
    readln(n);
    kol := 0;
    w := 0;
    sum := 0;
    k := 0;
    while (n > 0) do
    begin
        inc(kol);
        a[kol] := n mod 10;
        n := n div 10;
    end;

    for i := kol downto 1 do
    begin
        w := a[i];
        for j := 1 to 20 do
            d[j] := 0;
        for j := i downto 1 do
        begin
            if (a[j] >= w) then
            begin
                d[j] := w;
                a[j] := a[j] - w;
            end
            else
            begin
                d[j] := a[j];
                a[j] := 0;
            end;
        end;

        for j := 1 to w do
        begin
            inc(sum);
            for u := i downto 1 do
            begin
                inc(k);
                if (d[u] >= 1)   then
                b[k] := 1
                else

                    b[k] := 0;
                dec(d[u]);

            end;
            inc(k);
            b[k] := -1;

        end;

    end;
    writeln(sum);
    for i := 1 to k do
        if (b[i] = -1) then
            write(' ')
        else
            write(b[i]);
    readln;
    readln;
end.

program ZadachaB2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
n, n1, max, k, k1, i, j1, i1, sum, sum1, c, p: integer;
bool: boolean;
a: array[1..7] of integer;
begin
  readln(n);
  bool:= true;
  max:= -1;
  n1:= n;
  c:= 0;
  while n > 0 do
    begin
      p:= n mod 10;
      if p > max then max:= p;
      n:= n div 10;
      inc(c);
    end;
  writeln(max);
  for i:= c downto 1 do
    begin
      p:= n1 mod 10;
      a[i]:= p;
      n1:= n1 div 10;
    end;
  while bool do
    begin
      sum:= 0;
      for i:= 1 to c do
        begin
          if a[i] <> 0 then
            begin
             dec(a[i]);
             write(1);
            end
          else if (a[i] = 0) and (i > k) then write(0);
          inc(sum, a[i]);
        end;
      for i:= 1 to c do
        if a[i] <> 0 then break;
      k:= i;
      write(' ');
      if sum = 0 then bool:= false;
    end;
  readln;
end.

var i,n,ans,x,j:longint;
    flag:boolean;
    a,b,f:array[-1..1000010]of longint;
begin
	a[0]:=0;
	for i:=1 to 1000000 do
	begin
		x:=i;flag:=true;
		while x<>0 do
		begin
			if x mod 10>1 then flag:=false;
			x:=x div 10;
		end;
		if flag then
		begin
			inc(a[0]);
			a[a[0]]:=i;
		end;
	end;
	//writeln(a[0]);
	fillchar(b,sizeof(b),63);
	readln(n);b[0]:=0;
	for i:=1 to n do
		for j:=1 to a[0] do
		begin
			if i<a[j] then break;
			if b[i-a[j]]+1<b[i] then
			begin
				b[i]:=b[i-a[j]]+1;
				f[i]:=i-a[j];
			end;
		end;
	writeln(b[n]);
	while n<>0 do
	begin
		write(n-f[n],' ');
		n:=f[n];
	end;
end.

var
 c,t,i,j,n,m,k,kol,ans,res:longint;
 a:array[0..1000] of longint;
 max:char;
 s:string;
begin
 {assign(input,'input.txt');
 reset(input);
 assign(output,'output.txt');
 rewrite(output);}
 readln(s);
 max:='1';
 for i:=1 to length(s) do if s[i]>max then max:=s[i];
 m:=ord(max)-48;
 t:=1;
 for i:=length(s) downto 1 do
 begin
  c:=ord(s[i])-48;
  for j:=1 to c do inc(a[j],t);
  t:=t*10;
 end;
 writeln(m);
 for i:=1 to m do write(a[i],' ');
end.

uses math, sysutils;
var
  ans : array[1..9] of string;
  s : string;
  count,i,j,n,m : longint;
begin
  readln(n);
  s := inttostr(n);
  count := 0;
  for i := 1 to length(s) do count := max(count, strtoint(s[i]));
  writeln(count);
  for i := 1 to 9 do ans[i] := '0000000';
  for i := length(s) downto 1 do begin
    m := strtoint(s[i]);
    for j := 1 to m do ans[j][i + 7 - length(s)] := '1';
  end;
  for i := 1 to count do write(strtoint(ans[i]), ' ');
end.

Uses
  Math;
Var
  n,l,st,mx,j,i:longint;
  r:array[1..7]of longint;
  an:array[1..9]of longint;
begin
//  assign(input,'input.txt');assign(output,'output.txt');
  readln(n);l:=0;mx:=0;
  while n<>0 do
    begin
      inc(l);
      r[l]:=n mod 10;
      mx:=max(mx,r[l]);
      n:=n div 10;
    end;
  writeln(mx);
  for i:=1 to mx do
    an[i]:=0;
  st:=1;
  for i:=1 to l do
    begin
      for j:=1 to r[i] do
        inc(an[j],st);
      st:=st*10;
    end;
  for i:=1 to mx do
    write(an[i],' ');
end.

{$mode objfpc}
var n,i,k,j,max:integer;t:boolean;
    a:array[0..1000] of integer;
begin
 read(n);
 i:=0;
 max:=low(integer);
 while n>0 do
  begin
   inc(i);
   a[i]:=n mod 10;
   n:=n div 10;
   if a[i]>max then max:=a[i];
  end;
 writeln(max);
 for j:=1 to max do
  begin
   t:=false;
   for k:=i downto 1 do
    begin
     if (a[k]=0) and (t=true) then write('0');
     if (a[k]>0) then
      begin
       write('1');
       dec(a[k]);
       t:=true;
      end;
    end;
   write(' ');
  end;
end.

var a:array[1..100] of longint;
    i,c,n,b,t:longint;
    begin
    readln(n);
    c:=1; t:=0;
    while n>0 do
      begin
      b:=n mod 10;
      for i:=1 to b do
        a[i]:=a[i]+c;
      if b>t then t:=b;
      c:=c*10;
      n:=n div 10;
      b:=0;
      end;
    writeln(t);
    for i:=1 to t do
      write(a[i],' ');
    end.

const vocung=maxlongint div 2;

var ds:array[1..200] of longint;

    f,trace:array[0..1000000] of longint;

    n,l:longint;

procedure dequy(i,x:longint);
begin
    if i>7 then
        begin
            inc(l);
            ds[l]:=x;

            exit;
        end;

    dequy(i+1,x*10+0);
    dequy(i+1,x*10+1);
end;

procedure xuly;
var i,j,tg:longint;
begin
    readln(n);

    if n=1000000 then
        begin
            writeln(1);
            writeln(n);

            halt;
        end;

    dequy(1,0);

    for i:=1 to l-1 do
        for j:=i+1 to l do
            if ds[i]>ds[j] then
                begin
                    tg:=ds[i]; ds[i]:=ds[j]; ds[j]:=tg;
                end;

    for i:=1 to n do f[i]:=vocung;
    f[0]:=0;

    for i:=1 to n do
        for j:=1 to l do
            if (i>=ds[j]) and (f[i]>f[i-ds[j]]+1) then
                begin

                    f[i]:=f[i-ds[j]]+1;
                    trace[i]:=j;
                end;

    writeln(f[n]);

    i:=n;
    while i>0 do
        begin
            write(ds[trace[i]],' ');
            i:=i-ds[trace[i]];
        end;
end;

begin

//    assign(input,'nhap.inp'); reset(input);

    xuly;
end.

var s:string;
i,k,v,max,j:longint;
a:array[0..100000] of longint;
begin
//assign(input,'zejz.in');reset(input);
//assign(output,'zejz.out');rewrite(output);
readln(s);
k:=1;
for i:=length(s) downto 1 do
 begin
 val(s[i],v);
 for j:=1 to v do
  a[j]:=a[j]+k;
 if v>max then
  max:=v;
 k:=k*10;
 end;
writeln(max);
for i:=1 to max-1 do
 write(a[i],' ');
write(a[max]);
close(input);
close(output);
end.

const fi='';
      fo='';

var n,min,res:longint;
    s,ans:string;
    a,b:array[0..10] of longint;
    f,g:text;

procedure doc;
begin
    readln(f,s);
end;

procedure chuanbi;
var i:longint;
begin
    n:=length(s);
    for i:=1 to n do
        begin
            a[i]:=ord(s[i])-48;
        end;
end;

procedure xuli;
var i,x,y,j:longint;
begin
    x:=1;y:=1;
    while x<=n do
        begin
            for i:=1 to n do b[i]:=0;
            min:=high(longint);
            for i:=x to n do
                begin
                    if a[i]>0 then b[i]:=1;
                    if (a[i]>0) and (a[i]<min) then min:=a[i];
                end;
            for i:=x to n do
                a[i]:=a[i]-b[i]*min;
            y:=n+1;x:=n+1;
            for i:=1 to n do
                if b[i]>0 then
                    begin
                        y:=i;break;
                    end;
            for i:=1 to n do
                if a[i]>0 then
                    begin
                        x:=i;break;
                    end;
            for i:=1 to min do
                begin
                    inc(Res);
                    for j:=y to n do
                        ans:=ans+chr(b[j]+48);
                    ans:=ans+' ';
                end;
        end;
end;

procedure ghi;
begin
    writeln(g,res);
    writeln(g,ans);
end;

begin
    assign(f,fi);reset(f);
    assign(g,fo);rewrite(g);
        doc;
        chuanbi;
        xuli;
        ghi;
    close(f);close(g);
end.

var
n,x,max:int64;
i:longint;
a,b:array[1..9] of int64;
begin
readln(n);
b[1]:=1;
while(n<>0)do  begin
inc(i);
if i<>1
then b[i]:=b[i-1]*10;
a[i]:=n mod 10;
n:=n div 10;
if a[i]>max
then max:=a[i];
end;
writeln(max);
while true do begin
x:=0;
for i:=1 to 9 do
if a[i]<>0
then begin
dec(a[i]);
inc(x,b[i]);
end;
if x=0
then halt;
write(X,' ');
end;
end.

var
 mx,i,j,n,m,k,t,x:longint;
 s,ss:ansistring;
 a:array[0..11]of longint;
 c:char;
begin
 readln(s);
 n:=length(s);
 for i:=1 to n do begin a[i]:=ord(s[i])-48;if a[i]>mx then mx:=a[i];end;
 writeln(mx);
 for i:=1 to mx do
 begin
  ss:='';
  for j:=1 to n do if a[j]=0 then write(ss)else begin write(1);dec(a[j]);ss:='0';end;
  write(' ');
 end;
 writeln;
end.

var a,b:array[1..1000000] of longint;

ans1,ans,i,j,k,l,m,n:longint;
s,s1:string;

function prov(n:longint):longint;
var i,j,k:longint;
      s,s1:string;

begin
str(n,s);
s1:='';
for i:=1 to length(s) do
 if s[i]='0' then s1:=s1+'0' else s1:=s1+'1';
val(s1,k,j);
prov:=k;

end;

begin
readln(n);
m:=0;
ans:=0;
while n<>0 do
 begin
 inc(ans);
 inc(m);
 b[m]:=prov(n);
 n:=n - (prov(n));
  end;
writeln(ans);
for i:=1 to ans do
write(b[i],' ');
end.

program zad_A;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
    a, d, b :array[1..150000] of integer;
    n, kol, i, j, sum, v, u, k :integer;
    p: char;

begin
    p := ' ';
    readln(n);
    kol := 0;
    sum := 0;
    k := 0;
    while (n > 0) do
    begin
        inc(kol);
        a[kol] := n mod 10;
        n := n div 10;
    end;
    for i := kol downto 1 do
    begin
        v := a[i];
        for j := 1 to 20 do
            d[j] := 0;
        for j := i downto 1 do
        begin
            if (a[j] >= v) then
            begin
                d[j] := v;
                a[j] := a[j] - v;
            end
            else
            begin
                d[j] := a[j];
                a[j] := 0;
            end;
        end;
        for j := 1 to v do
        begin
            inc(sum);
            for u := i downto 1 do
            begin
                inc(k);
                if (d[u] >= 1)   then
                b[k] := 1
                else

                    b[k] := 0;
                dec(d[u]);

            end;
            inc(k);
            b[k] := -1;
        end;
    end;
    write(sum);
    writeln;
    for i := 1 to k do
        if (b[i] < 0) then
            write(p)
        else
            write(b[i]);
end.

uses sysutils;
var
        i,i2,o,inp,tmp:longint;
        a:array[1..9] of longint;
        s:string;
begin
        readln(inp);
        s:=inttostr(inp);
        for i:=1 to length(s) do
        begin
                if (strtoint(s[i])>o) then
                        o:=strtoint(s[i]);
                tmp:=1;
                for i2:=1 to (length(s)-i) do
                        tmp:=tmp*10;
                for i2:=1 to (strtoint(s[i])) do
                        a[i2]:=a[i2]+tmp;
        end;
        writeln(o);
        for i:=1 to o do
                write(a[i],' ');
end.

var
 x,ti,l,c,stn,i,j,n,m,k,kol,res:longint;
 f,p,t,ans,d,b,st,a:array[0..2000000] of longint;
 s:string;
 fi:integer;

function min(a,b:longint):longint;
begin
 if a<b then min:=a else min:=b;
end;

procedure rec(q,k:longint);
var
 i:longint;
begin
 st[k]:=a[q];
 if k=j then
 begin
  for i:=1 to k do s:=s+chr(st[i]+48);
  val(s,c,fi);
  inc(stn);
  b[stn]:=c;
  s:='';
  exit;
 end;
 for i:=1 to 2 do rec(i,k+1);
end;

procedure qsort(l,r:longint);
var
 i,j,t,m:longint;
begin
 i:=l;
 j:=r;
 m:=b[l+random(r-l+1)];
 repeat
  while b[i]<m do inc(i);
  while b[j]>m do dec(j);
  if i>j then break;
  t:=b[i];
  b[i]:=b[j];
  b[j]:=t;
  inc(i);
  dec(j);
 until i>j;
 if l<j then qsort(l,j);
 if i<r then qsort(i,r);
end;

begin
{ assign(input,'input.txt');
 reset(input);
 assign(output,'output.txt');
 rewrite(output); }
 readln(n);
 a[1]:=0; a[2]:=1;
 for j:=1 to 6 do
 begin
  for i:=1 to 2 do rec(i,1);
 end;
 qsort(1,stn);
 for i:=1 to stn do if b[i]<>b[i+1] then
 begin
  inc(kol);
  d[kol]:=b[i];
 end;
 inc(kol);
 d[kol]:=1000000;
 f[0]:=0;
 for i:=1 to n do f[i]:=maxlongint div 2;
 t[0]:=1;
 for i:=0 to n do
 begin
  for j:=1 to kol do if t[i]>0 then if i+d[j]<=1000000 then
  begin
   t[i+d[j]]:=1;
   if f[i+d[j]]>f[i]+1 then
   begin
    f[i+d[j]]:=min(f[i+d[j]],f[i]+1);
    p[i+d[j]]:=i;
   end;
  end;
 end;
 x:=n;
 while x>0 do
 begin
  inc(ti);
  ans[ti]:=x;
  x:=p[x];
 end;
 writeln(ti);
 for i:=1 to ti do write(ans[i]-ans[i+1],' ');
end.

program Project300;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;
var i,a,b,n:integer;   s:string;
    m:array[1..6]of integer;
begin
 // reset(input,'input.txt');
 // rewrite(output,'output.txt');
  readln(a);
  n:=0;
  While a>0 do
   begin
    b:=a mod 10;
    a:=a div 10;
    inc(n);
    m[n]:=b;
   end;
  a:=0;
  for i:=1 to n do a:=max(m[i],a);
  writeln(a);
 While true do
  begin
   b:=n;
   While (m[b]=0)and(b>0) do dec(b);
   if b=0 then break;
   for i:=b downto 1 do
    begin
      if m[i]>0 then
      begin
       write('1');
       dec(m[i]);
      end
      else write('0');
    end;
   write(' ');
  end;
end.

var z,i,m,j,k:longint;
a:array[1..10000] of longint;
n:string;
begin
///assign(input,'zrjz.in');reset(input);
//(output,'zrjz.out');rewrite(output);
readln(n);
z:=1;
for i:=length(n) downto 1 do
  begin
  m:=ord(n[i])-48;

  for j:=1 to m do
    a[j]:=a[j]+z;
  if m>k then k:=m;
  z:=z*10;
  end;
writeln(k);
for i:=1 to k do
  write(a[i],' ');
close(input);close(output);
end.

var n,x,i,j,max,cod:longint;
    s:string;
    a:array[1..10]of longint;
    b:array[1..10,1..10]of longint;
begin
read(n);
str(n,s);
val(s[1],max,cod);

for i:=2 to length(s) do
   begin
   val(s[i],x,cod);
   if x>max then max :=x;
   end;

for i:=1 to length(s) do
   begin
   a[length(s)-i+1]:=n mod 10;
   n:=n div 10;
   end;

for i:=1 to max do
   begin
   for j:=1 to length(s) do
      if a[j]>0 then begin b[i,j]:=1; dec(a[j]) end;
   end;

writeln(max);
for i:=1 to max do
   begin
   j:=1;
   while b[i,j]=0 do inc(j);
   while j<=length(s) do begin write(b[i,j]); inc(j) end;
   write(' ');
   end;
end.

var b:array[1..100] of longint;
    i,c,n,s,a,t:longint;
begin
readln(n);
s:=n;
c:=1;
while(n>0)do
 begin
  a:=n mod 10;
  for i:=1 to a do
   b[i]:=b[i]+c;
  if(a>t)then t:=a;
  c:=c*10;
  n:=n div 10;
  a:=0;
 end;

writeln(t);

for i:=1 to t do
  write(b[i],' ');
end.

var
  n,i,cnt:longint;
  t,s:string;
  a:array[0..100001] of longint;
begin
  read(n);
  while n>0 do begin
    str(n,s);
	t:='';
	for i:=1 to length(s) do if s[i]>'0' then begin t:=t+'1'; s[i]:=chr(ord(s[i])-1); end else t:=t+'0';
	inc(cnt); val(t,a[cnt]); val(s,n);
  end;
  writeln(cnt);
  for i:=1 to cnt do write(a[i],' ');
end.

program zd1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
    n, i, j, free, q, f, sum: integer;
    a, b: array[1..1000100] of integer;

begin
    readln(n);
        j := n;
        q := 0;
        while (j > 0) do
        begin
            if (j mod 10 > 1) then
            begin
                q := 1;
                break;
            end;
            j := j div 10;
        end;
    if (q = 0) then
    begin
        writeln(1);
        writeln(n);
        halt;
    end;
    free := 0;
    for i := 1 to n div 2 do
    begin
        j := i;
        q := 0;
        while (j > 0) do
        begin
            if (j mod 10 > 1) then
            begin
                q := 1;
                break;
            end;
            j := j div 10;
        end;
        if (q > 0) then
            continue;
        inc(free);
        a[free] := i;
    end;
    f := 0;
    i := free;
    while (i > 0) do
    begin
        while (a[i] <= n) do
        begin
            inc(f);
            b[f] := a[i];
            n := n - a[i];
        end;
        dec(i);
    end;
    writeln(f);
    for i := 1 to f do
        write(b[i], ' ');
    readln;
    readln;
end.

program zd1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
    n, i, j, free, q, f, sum: integer;
    a, b: array[1..1000100] of integer;

begin
    readln(n);
    free := 0;
    for i := 1 to n do
    begin
        j := i;
        q := 0;
        while (j > 0) do
        begin
            if (j mod 10 > 1) then
            begin
                q := 1;
                break;
            end;
            j := j div 10;
        end;
        if (q > 0) then
            continue;
        inc(free);
        a[free] := i;
    end;
    f := 0;
    i := free;
    while (i > 0) do
    begin
        while (a[i] <= n) do
        begin
            inc(f);
            b[f] := a[i];
            n := n - a[i];
        end;
        dec(i);
    end;
    writeln(f);
    for i := 1 to f do
        write(b[i], ' ');
    readln;
    readln;
end.

program zad_A;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
    a, d :array[1..123456] of integer;
    n, kol, i, j, sum, w, u :integer;

begin
    readln(n);
    kol := 0;
    w := 0;
    while (n > 0) do
    begin
        inc(kol);
        a[kol] := n mod 10;
        n := n div 10;
    end;

    for i := kol downto 1 do
    begin
        w := a[i];
        for j := 1 to 20 do
            d[j] := 0;
        for j := i downto 1 do
        begin
            if (a[j] >= w) then
            begin
                d[j] := w;
                a[j] := a[j] - w;
            end
            else
            begin
                d[j] := a[j];
                a[j] := 0;
            end;
        end;

        for j := 1 to w do
        begin
            for u := i downto 1 do
            begin
                if (d[u] >= 1)   then
                write(1)
                else

                    write(0);
                dec(d[u]);

            end;
            write(' ');
        end;

    end;

    readln;
    readln;
end.

program zad_A;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
    a, d :array[1..123456] of integer;
    n, kol, i, sum :integer;

procedure sort(l, r:integer);
var
    x, q, i, j:integer;
begin
    x := a[random(r - l + 1) +l];
    i := l;
    j := r;
    while (i < j) do
    begin
        while (a[i] < x) do
            inc(i);
        while (a[j] > x) do
            dec(j);
        if (i <= j) then
                  begin
                      q := a[i];
                      a[i] := a[j];
                      a[j] := q;
                      inc(i);
                      dec(j);
                  end;
    end;

    if (l < j) then sort(l, j);
    if (i < r) then sort(i, r);
end;

procedure rec(v :integer);
begin
    if (v > 10000000) then
        exit;
    inc(kol);
    a[kol] := v;
    rec(v * 10 + 1);
    rec(v * 10);
end;

begin
    readln(n);
     kol := 0;
    rec(1);

    sum := 0;
    sort(1, kol);
    for i := kol downto 1 do
    begin
        while (n >= a[i]) do
        begin
            inc(sum);
            d[sum] := a[i];
            n := n - a[i];
        end;
    end;
     writeln(sum);
     for i := 1 to sum do
        write(d[i], ' ');
    readln;
    readln;
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
x: array of integer;
s, h: string;
a,i,b, max, j, z: integer;
q: array [0..1000]  of longint;
begin
max:=0;
readln(s);
a:=length(s);
setlength(x, a);
  for i:= 1 to a do
  x[i-1]:=strtoint(s[i]);
z:=1;
q[0]:=0;
  for i:=0 to a-1 do
    if max<x[i] then max:=x[i];
  while   max<>0 do
    begin
      for i:=1 to a do
        begin
          if  (x[i-1]<>0) then
            begin
              q[z]:=round(power(10, a-i)) + q[z];
              x[i-1]:=x[i-1] - 1;
            end;
          end;
     z:=z+1;
     max:=max-1;
     end;
for i:=1 to z-1 do
write(q[i], ' ')   ;

readln;
readln;
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
x: array of integer;
s, h: string;
a,i,b, max, j, z: integer;
q: array [0..1000]  of longint;
begin
max:=0;
readln(s);
a:=length(s);
setlength(x, a);
  for i:= 1 to a do
  x[i-1]:=strtoint(s[i]);
z:=1;
q[0]:=0;
  for i:=0 to a-1 do
    if max<x[i] then max:=x[i];
  while   max<>0 do
    begin
      for i:=1 to a do
        begin
          if  (x[i-1]<>0) then
            begin
              q[z]:=round(power(10, a-i)) + q[z];
              x[i-1]:=x[i-1] - 1;
            end;
          end;
     z:=z+1;
     max:=max-1;
     end;
for i:=1 to z-1 do
if i<>z-1 then
write(q[i], ' ')
else
write(q[i]);
readln;
end.

Uses
  Math;
Var
  n,l,st,mx,j,i:longint;
  r:array[1..6]of longint;
  an:array[1..9]of longint;
begin
  readln(n);l:=0;mx:=0;
  while n<>0 do
    begin
      inc(l);
      r[l]:=n mod 10;
      mx:=max(mx,r[l]);
      n:=n div 10;
    end;
  writeln(mx);
  for i:=1 to mx do
    an[i]:=0;
  st:=1;
  for i:=1 to l do
    begin
      for j:=1 to r[i] do
        inc(an[j],st);
      st:=st*10;
    end;
  for i:=1 to mx do
    write(an[i],' ');
end.

var i,min,aint,count:integer;
a,x,y,sa:string;
arr:array[1..7]of integer;
begin
read(a);
sa:=a;
aint:=strtoint(a);

repeat
min:=10;
y:='';
for i:=1 to length(a) do y:=y+1;
aint:=aint-strtoint(y);
count:=count+1;
a:=inttostr(aint);
until aint<=0;
writeln(count);

aint:=strtoint(sa);
repeat
min:=10;
y:='';
for i:=1 to length(sa) do begin
x:=sa[i];
arr[i]:=strtoint(x);
end;
for i:=1 to length(sa) do y:=y+1;
for i:=1 to length(sa) do
if arr[i]=0 then y[i]:='0';
print(y);
aint:=aint-strtoint(y);
sa:=inttostr(aint);
until aint<=0;

end.

var r,max,n,i,j,tek:longint;
    a:Array[1..1000]of longint;
    fl:boolean;
begin
 read(n);
 while n>0 do
  begin
   inc(tek);
   a[tek]:= n mod 10;
   n:=n div 10;
  end;
 for i:=1 to tek div 2 do
  begin
  r:=a[i];
  a[i]:=a[tek-i+1];
  a[tek-i+1]:=r;
 end;
 for i:=1 to tek do
  if max<a[i]
   then max:=a[i];
 for i:=1 to max do
  begin
   fl:=false;
   for j:=1 to tek do
    if a[j]>0
     then begin dec(a[j]);
                write(1);
                fl:=true;
          end
     else if fl=true
           then write(0);
   write(' ');
  end;

end.

program ZAD_B;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   n,i,j,s:integer;
   a:array [1..65] of integer;
   d,d1,d2:array [0..1000000] of integer;
procedure rec(k:integer);
begin
   if (k=0) then exit;
   rec(d2[k]);
   if (k=n) then writeln(d1[k])
   else write(d1[k],' ');
end;
begin
   readln(n);
   s := 0;
   for i:=1 to n do
      begin
         j:=i;
         while (j>0) do
            begin
               if (j mod 10 <> 0) and (j mod 10 <>1) then break;
               j:=j div 10;
            end;
         if (j = 0) then
            begin
               inc(s);
               a[s]:=i;
            end;
      end;
   d[0] := 0;
   for i:=1 to n do
      begin
         d[i]:=maxint;
         for j:=1 to s do
            if (i-a[j]>=0) and (d[i-a[j]]+1<d[i]) then
               begin
                  d[i]:=d[i-a[j]]+1;
                  d1[i]:=a[j];
                  d2[i]:=i-a[j];
               end;
      end;
   rec(n);
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
    s, s1: string;
    i, j, n, k, free: integer;
    a, b: array [1..10000] of integer;
begin
    readln(n);
    free := 0;
    for i := 1 to 1000000 do
    begin
        k := 0;
        s := inttostr(i);
        for j := 1 to length(s) do
            if (s[j] <> '1') and (s[j] <> '0') then k := 13;
        if k = 0 then
        begin
            inc(free);
            a[free] := i;
        end;
    end;
    //writeln(free);
    k := 0;
    while (n > 0) and (free > 0) do
    begin
        while n >= a[free] do
        begin
            inc(k);
            n := n - a[free];
            b[k] := a[free];
        end;
        dec(free);
    end;
    writeln(k);
    for i := 1 to k do
        write(b[i],' ');
    readln;
end.

const eps=0.0000000001;  besk=20000000000008;  nn=200000;

   label 1,2,3,4;
    type   { real=double;}  {string=ansistring;}
    mas=array [-10..nn] of longint;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var ppp,modul,v1,v2,kol,t,p,sum,k1,ii,jj,q,pos,z,pmax,imax,p3,p4,l,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1:int64;
    ot,h,nap,pp1,pp2,mask1,mask2,mask,newnapy,posi,posj,time,pp,step, k,t1,i,j:longint;
   kk,osn, aaa,bbb, bb,ccc,dd:int64;
     dost,aa,mm,tt,ll,r,x,y,fact,d,c,aold,b,a:array[-10..3000000] of int64;
     al,ar:  array[-10..1200,-10..1200] of int64;
    ver, dda:   array[-10..1200,-10..1200] of extended;
     marked:array[-10..3000030] of boolean;
   zanx,zany:array[-10..200000] of boolean;
    sss, ss1,ss2:string;
    sot:array [-10..1000000] of char;
     zan,fl:array[-10..200000] of boolean;
    ss:string;ch:char;
   ddp, pole :array [-100..200,-100..200] of int64;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     p1,p2,v0,s0,t0:extended;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    function phi(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     phi:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function degg(p,deg:int64):int64; var pp,q:int64;
 begin if deg=0 then degg:=1 else begin   if odd(deg) then degg:=degg(p,deg-1)*p mod modul else
 begin q:=(degg(p,deg shr 1)) mod modul; degg:=(q*q) mod modul;   end; end;   end;

function bmena:boolean; var i,j:longint; fl:boolean;
  begin
     fl:=false; for i:=0 to n-1 do if b[i]<aa[i] then
     begin fl:=true; {writeln('men ',i);} break;  end else if b[i]>aa[i] then begin {writeln('bol ',i);} break;  end;
    bmena:=fl;
  end;

begin
  {  assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
     read(ppp);

      for i:=0 to 1000000 do d[i]:=1000000000;
     for step:=1 to 6 do
     begin
       p:=1 shl step;
       for mask:=0 to p-1 do
          begin
             t:=0;  q:=mask;
             for i:=1 to step do begin b[i]:=q mod 2; q:=q div 2; end;
             for i:=1 to step do if b[i]=0
              then t:=10*t else t:=10*t+1;
             inc(pp); a[pp]:=t;

          end;

      end;

     {   for i:=1 to pp do write(a[i],' '); writeln;
    } for i:=1 to pp do for j:=1 to pp-1 do if a[j]>a[j+1] then
    begin  t:=a[j]; a[j]:=a[j+1]; a[j+1]:=t;  end;
            {   for i:=1 to pp do write(a[i],' '); writeln;
          } t:=0;  a[0]:=-100;
         for i:=1 to pp do  if a[i]>a[i-1] then begin  inc(t); c[t]:=a[i]; end;
       {  writeln(t);
         for i:=1 to t do write(c[i],' '); writeln;
      } d[0]:=0;
       for i:=0 to 1000000 do for j:=1 to t do
         begin
            d[i+c[j]]:=min(d[i+c[j]],d[i]+1);
            if    d[i+c[j]]=d[i]+1 then dost[i+c[j]]:=i;

         end;
     {   for i:=1 to 40 do write(d[i],' ');writeln;
        for i:=1 to 40 do write(dost[i],' ');writeln;
      }
      p:=ppp;
      writeln(d[p]);
      while p>0 do begin  write(p-dost[p],' '); p:=dost[p];  end;

   1:          close(output);
end.

uses sysutils;
var
	s1,s,sc: longint;
	n	: longint;
	a,k	: string;
	min,m	: integer;
begin
	readln(n);
	s:=1;
	s1:=1;
	while s<n do
	begin
		inc(s1);
		s:=s*10;
	end;
	if s>n then
	begin
		dec(s1);
		s:= s div 10;
	end;

	while n>0 do
	begin
                while s>n do
                begin
                        dec(s1);
                        s:=s div 10;
                end;
		a:=inttostr(n);
		k:='';
		min:=9;
		for sc:= 1 to s1 do
		begin
			if a[sc]='0' then k:=k+'0' else k:=k+ '1';
			if (strtoint(a[sc])<min) and (a[sc]<>'0') then min:= strtoint(a[sc]);
		end;
		for m:= 1 to min-1 do
		begin
			write(k,' ');
			n:=n-strtoint(k);

		end;
		write(k);
                n:=n-strtoint(k);
		if n>0 then write(' ');
	end;
	writeln;
end.

var
        num     : array[1..7] of longint;
        n       : longint;
        s,s1    : longint;
        ans     : array[1..10000] of longint;
        c       : integer;
begin
        readln(n);
        num[1]:=1;
        num[2]:=11;
        num[3]:=111;
        num[4]:=1111;
        num[5]:=11111;
        num[6]:=111111;
        num[7]:=1000000;
        s :=1;
        s1:=1;
        while s<n do
        begin
                s:=s*10;
                inc(s1);
        end;
        if s>n then
        begin
                dec(s1);
                s:=s div 10;
        end;
        c:=0;
        s:=1;
        while n>0 do
        begin
                while num[s1]<=n do
                begin
                        n:=n-num[s1];
                        inc(c);
                        ans[c]:=num[s1];
                end;
                dec(num[s1],s);
                s:=s*10;
                if num[s1]=0 then
                begin
                        s:=1;
                        dec(s1);
                end;
        end;
        writeln(c);
        for s:= 1 to c-1 do
        write(ans[s],' ');
        writeln(ans[c]);
end.

var
 mx,i,j,n,m,k,t,x:longint;
 s:ansistring;
 a:array[0..11]of longint;
begin
 readln(s);
 n:=length(s);
 for i:=1 to n do begin a[i]:=ord(s[i])-48;if a[i]>mx then mx:=a[i];end;
 writeln(mx);
 for i:=1 to mx do
 begin
  for j:=1 to n do if a[j]=0 then write(0)else begin write(1);dec(a[j]);end;
  write(' ');
 end;
 writeln;
end.

var
 mx,i,j,n,m,k,t,x:longint;
 s:ansistring;
 a:array[0..11]of longint;
 c:char;
begin
 readln(s);
 n:=length(s);
 for i:=1 to n do begin a[i]:=ord(s[i])-48;if a[i]>mx then mx:=a[i];end;
 writeln(mx);
 for i:=1 to mx do
 begin
  c:=#0;
  for j:=1 to n do if a[j]=0 then write(c)else begin write(1);dec(a[j]);c:='0';end;
  write(' ');
 end;
 writeln;
end.

uses math;
const fi = '';
      fo = '';
var a: array[1..10] of longint;
    c: char;
    i, j, k, so, n, l, e: longint;
    b: array[1..10] of string;
begin
  assign(input,fi);       reset(input);
  assign(output,fo);        rewrite(output);

  n:=0;
  while not eoln do
   begin
    inc(n);
    read(c);
    val(c,a[n],e);
   end;
  k:=0;
  for i:=1 to n do k:=max(k,a[i]);
  for i:=1 to n do
   begin
    for j:=1 to a[i] do b[j]:=b[j]+'1';
    for j:=a[i]+1 to k do b[j]:=b[j]+'0';
   end;
  writeln(k);
  for i:=1 to k do write(b[i],' ');

  close(input);         close(output);
end.

var i,n,x,br:longint; a:array[1..1000]of integer;
function trazi(y:longint):longint;
var d,c:longint; t:boolean;
begin
for i:=y downto 1 do
begin
d:=i;
t:=true;
while(d>0)do
begin
c:=d mod 10;
d:=d div 10;
if(c<>0)and(c<>1)then begin t:=false; break; end;
end;
if t then begin trazi:=i; break; end;
end;

end;
begin
read(n);
while(n>0)do
begin
x:=trazi(n);
inc(br);
a[br]:=x;
n:=n-x;
end;
writeln(br);
for i:=1 to br do
write(a[i],' ');
end.

var a,b:array[1..1000000] of longint;

ans1,ans,i,j,k,l,m,n:longint;
s,s1:string;

function prov(n:longint):boolean;
var i,j:longint;
      s:string;

begin
str(n,s);
j:=0;
for i:=1 to length(s) do
if (s[i]<>'0') and (s[i]<>'1') then inc(j);
if j=0 then prov:=true else prov:=false;
end;

begin
readln(n);
m:=0;
ans:=0;
for i:=1 to n do
if prov(i) then begin inc(m); a[m]:=i; end;
while n<>0 do
  begin
  ans1:=ans;
  ans:=ans+n div (a[m]);
  if ans<>ans1 then begin
                    for i:=ans1+1 to ans do
                    b[i]:=a[m];
                    end;
  n:=n mod a[m];
  while (a[m]>n) and (m<>0) do
  dec(m);
  end;
writeln(ans);
for i:=1 to ans do
write(b[i],' ');
end.

program cfb;
var
  a:longint;
  b:array[1..100000] of longint;
  i,n,m,j,k,z,ma:longint;
procedure p(x:longint);
 var
   kk:longint;
 begin
      while (x>0) do
      begin
        inc(kk);
        x:=x div 10;
      end;
      n:=kk;
      end;
function s(x:longint):longint;
var
  i1,j1:longint;
begin
     j1:=1;
     for i1:=1 to x do
     j1:=j1*10;
     s:=j1;
end;
 begin
   read(a);
   P(a);
       z:=1;
       ma:=0;
   while a>0 do
   begin
   k:=a mod 10;
   for i:=1 to k do
   b[i]:=b[i]+z;
   z:=z*10;
   if k>ma then ma:=k;

   a:=a div 10;

   end;
   for i:=1 to ma do
   write(b[i],' ');
 end.

var
sums,i,n,q:longint;
c:array[0..6]of longint;
ss,s:string;

begin
read(N);
if n=0 then begin writeln(0);halt;end;
str(n,s);
for i:=1 to length(s) do
begin
c[i]:=ord(s[i])-48;
sums:=sums+c[i];
end;
while sums>0 do
        begin
                ss:='';
                for i:=1 to length(s) do

                if c[i]>0 then
                        begin
                        ss:=ss+'1';
                        dec(sums);
                        dec(c[i]);
                        end

                        else ss:=ss+'0';
                while ss[1]='0' do delete(ss,1,1);
                write(ss,' ');
        end;
end.

program CF300B;
var a,b,c,d,i,n,j,k:longint; Z:array[1..100000] of longint;
s,s1:string;
begin
{assign(input,'d:\FPC\input.txt');
reset(input);
assign(output,'d:\FPC\output.txt');
rewrite(output);}
read(s);
a:=length(s);
while a>1 do
begin
for i:=1 to a do
 if ord(s[i])>48 then
  begin
  s[i]:=chr(ord(s[i])-1);
  s1:=s1+'1';
  end
   else s1:=s1+'0';
s1:=s1+' ';
if s[1]='0' then
begin
for i:=2 to a do
s[i-1]:=s[i];
a:=a-1;
end;
if a=1 then break;
end;
for i:=1 to length(s1) do
if s1[i]=' ' then k:=k+1;
k:=k+ord(s[1])-48;
writeln(k);
write(s1);
for i:=1 to ord(s[1])-48 do
write(1,' ');
end.

var
b:array[1..100] of integer;
i,c,n,a,t:integer;
begin
c:=1;
readln(n);
while(n>0)do
begin
a:=n mod 10;
for i:=1 to a do
b[i]:=b[i]+c;
if(a>t)then t:=a;
c:=c*10;
n:=n div 10;
a:=0;
end;
for i:=t downto 1 do
write(b[i]);
readln;
end.

type
        arr     =array[1..6] of longint;

var
        N       :longint;
        res     :array[0..1000000] of longint;
        sl      :array[0..1000000] of longint;
        dem     :longint;
        x       :arr;
        x1      :arr;

procedure       tach(var x:arr);
var     mi,ma,i:longint;xx:longint;mul:longint;
Begin
        mi:=10;
        ma:=-1;
        mul:=1;
        xx:=0;
        for i:=N downto 1 do
                Begin
                    if x[i]>ma then ma:=x[i];
                    if (x[i]<mi) and (x[i]>0) then mi:=x[i];
                end;
        if ma=1 then
                begin
                    for i:=1 to N do
                        begin
                            xx:=xx+x[i]*mul;
                            mul:=mul*10;
                            x[i]:=0;
                        end;
                end;
        inc(dem);
        sl[dem]:=mi;
        for i:=n downto 1 do
              if x[i]>0 then
                 Begin
                     xx:=xx+mul;
                     mul:=mul*10;
                 end
              else
                 Begin
                     xx:=xx+mul;
                     mul:=mul*10;
                 end;
        res[dem]:=xx;
        for i:=1 to n do
              if x[i]>0 then
                    x[i]:=x[i]-mi;
end;

function        check:boolean;
var     i:longint;
Begin
        for i:=1 to N do
                if x[i]>1 then exit(false);
        exit(true);
end;

procedure       xuli;
var     i,j,xx,mul:longint;ok:boolean;
Begin
        readln(xx);
        N:=0;
        while xx>0 do
                Begin
                    inc(N);
                    x[N]:=xx mod 10;
                    xx:=xx div 10;
                end;
        dem:=0;
        fillchar(sl,sizeof(sl),0);
        while check=false do tach(x);
        ok:=false;
        for i:=n downto 1 do
              if x[i]>0 then
               begin
                        N:=i;
                        break;
               end;
        mul:=1;
        xx:=0;
        for i:=1 to N do
              if x[i]>0 then
                begin
                    xx:=xx+mul;
                    mul:=mul*10;
                end
              else mul:=mul*10;
        if xx>0 then
                begin
                    inc(dem);
                    sl[dem]:=1;
                    res[dem]:=xx;
                end;
        xx:=0;
        for i:=1 to dem do
                xx:=xx+sl[i];
        writeln(xx);
        for i:=1 to dem do
                for j:=1 to sl[i] do
                        write(res[i],' ');
end;

BEGIN
        xuli;
END.

type
        arr     =array[1..6] of longint;

var
        N       :longint;
        res     :array[0..1000000] of longint;
        sl      :array[0..1000000] of longint;
        dem     :longint;
        x       :arr;
        x1      :arr;

procedure       tach(var x:arr);
var     mi,ma,i:longint;xx:longint;mul:longint;
Begin
        mi:=10;
        ma:=-1;
        mul:=1;
        xx:=0;
        for i:=N downto 1 do
                Begin
                    if x[i]>ma then ma:=x[i];
                    if (x[i]<mi) and (x[i]>0) then mi:=x[i];
                end;
        if ma=1 then
                begin
                    for i:=1 to N do
                        begin
                            xx:=xx+x[i]*mul;
                            mul:=mul*10;
                            x[i]:=0;
                        end;
                end;
        inc(dem);
        sl[dem]:=mi;
        for i:=n downto 1 do
              if x[i]>0 then
                 Begin
                     xx:=xx+mul;
                     mul:=mul*10;
                 end
              else
                     mul:=mul*10;
        res[dem]:=xx;
        for i:=1 to n do
              if x[i]>0 then
                    x[i]:=x[i]-mi;
end;

function        check:boolean;
var     i:longint;
Begin
        for i:=1 to N do
                if x[i]>1 then exit(false);
        exit(true);
end;

procedure       xuli;
var     i,j,xx,mul:longint;ok:boolean;
Begin
        readln(xx);
        N:=0;
        while xx>0 do
                Begin
                    inc(N);
                    x[N]:=xx mod 10;
                    xx:=xx div 10;
                end;
        dem:=0;
        fillchar(sl,sizeof(sl),0);
        while check=false do tach(x);
        ok:=false;
        for i:=n downto 1 do
              if x[i]>0 then
               begin
                        N:=i;
                        break;
               end;
        mul:=1;
        xx:=0;
        for i:=1 to N do
              if x[i]>0 then
                begin
                    xx:=xx+mul;
                    mul:=mul*10;
                end
              else mul:=mul*10;
        if xx>0 then
                begin
                    inc(dem);
                    sl[dem]:=1;
                    res[dem]:=xx;
                end;
        xx:=0;
        for i:=1 to dem do
                xx:=xx+sl[i];
        writeln(xx);
        for i:=1 to dem do
                for j:=1 to sl[i] do
                        write(res[i],' ');
end;

BEGIN
        xuli;
END.

const   fi='';
        fo='';

var n:longint;
    f:text;
  res:longint;
    l:longint;
    x:array[0..1000000]of longint;
   nt:longint;
    t:array[0..65]of longint;
procedure nhap;
var c:char;
begin
     assign(f,fi);  reset(f);
              readln(f,n);
     close(f);
end;

function kt(i:longint):boolean;
begin
      while i<>0 do
         if i mod 10>1 then exit(false)
          else i:=i div 10;
      exit(true);
end;

procedure init;
var i,j:longint;
begin
      nt:=0;
      for i:=1 to n do
         if kt(i) then
           begin
                 inc(nt);
                 t[nt]:=i;
           end;
end;

procedure xuly;
var i,j,k:longint;
begin
       res:=0;
       while n>0 do
          begin
               for j:=nt downto 1 do
                 if t[j]<=n then
                    begin
                         inc(res);
                         x[res]:=t[j];
                         nt:=j;
                         dec(n,t[j]);
                         break;
                    end;
          end;
end;

procedure inkq;
var i:longint;
begin
      assign(f,fo);
      rewrite(f);
                writeln(f,res);
                for i:=1 to res do write(f,x[i],' ');
      close(f);
end;

BEGIN
     nhap;
     init;
     xuly;
     inkq;
END.

var
  a, b, c, i, max, j, t: int64;
  ar: array [1..1000] of int64;

begin
  readln(a);
  j := 1;
  max := 0;
  while a > 0 do begin
    if (a mod 10 > max) then max := a mod 10;
    ar[j] := a mod 10;
    inc(j);
    a := a div 10;
  end;
  writeln(max);
  i := 1;
  while i <= max do begin
    t := j - 1;
    while t > 0 do begin
      if (ar[t] > 0) then begin
        write(1);
        dec(ar[t]);
      end
      else write(0);
      dec(t);
    end;
    write(' ');
    inc(i);
  end;
end.

uses math;
var
  a,s,d,f,g,h:integer;
  z:shortstring;
  x:array [0..100000] of smallint;
begin
  readln(z);
  for s:=1 to length(z) do
  begin
  x[s]:=ord(z[s])-ord('0');
  a:=max(a,x[s]);
  end;
  for s:=1 to a do
  begin
    for d:=1 to length(z) do
    if (x[d]<>0) then begin dec(x[d]); h:=h*10+1 end else h:=h*10;
    write(h,' ');
    h:=0;
  end;
end.

var
b:array[1..100] of integer;
i,c,n,s,a,t:integer;
begin
c:=1;
readln(n);
s:=n;
while(n>0)do
begin
a:=n mod 10;
for i:=1 to a do
b[i]:=b[i]+c;
if(a>t)then t:=a;
c:=c*10;
n:=n div 10;
a:=0;
end;
writeln(s);
for i:=t downto 1 do
begin
write(b[i]);
write(' ');
end;
readln;
end.

var
b:array[1..100] of integer;
i,c,n,a,t:integer;
begin
c:=1;
readln(n);
while(n>0)do
begin
a:=n mod 10;
for i:=1 to a do
b[i]:=b[i]+c;
if(a>t)then t:=a;
c:=c*10;
n:=n div 10;
a:=0;
end;
for i:=t downto 1 do
begin
write(b[i]);
write(' ');
end;
readln;
end.

var
l,i,j:longint;
a:string;
max:char;
s:array[1..10000] of integer;
begin
readln(a);
for i:=1 to length(a) do if(a[i]>max) then max:=a[i];
writeln(max);
for i:=length(a) downto 1 do
begin
for j:=1 to ord(a[i])-48 do s[j]:=s[j]+l;
l:=l*10;
end;
for i:=1 to ord(max)-48 do write(s[i],' ');
end.

const fi='';
      fo='';
var n,i,max,tmp,mu,m:longint;
    a:array[1..9,1..1] of int64;

BEGIN
        assign(input,fi);reset(input);
        read(n);
        close(input);

        assign(output,fo);rewrite(output);
        m:=n;
        while m<>0 do begin
                if m mod 10>max then max:=m mod 10;
                m:=m div 10;
        end;
        writeln(max);
        if n<10 then for i:=1 to max do write(1,#32);
        m:=n;mu:=1;
        while (m<>0) and (n>10) do begin
                tmp:=m mod 10;
                for i:=1 to tmp do a[i][1]:=a[i][1]+mu*1;
                mu:=mu*10;
                m:=m div 10;
        end;
        if n>10 then for i:=1 to max do write(a[i][1],' ');
        close(output);
END.

var
a:string;
max,i,j:longint;
begin
readln(a);
for i:=1 to length(a) do if(ord(a[i])>max) then max:=ord(a[i]);
writeln(max-ord('0'));
for i:=1 to (max-ord('0')) do
begin
for j:=1 to length(a) do
begin
if(a[j]<>'0') then begin write('1'); ord(a[j]):=ord(a[j])-1; end
else
write('0')
end;
if(i=max-ord('0')) then writeln else write(' ');
end;
end.

var
a:string;
max,i,j:longint;
begin
readln(a);
for i:=1 to length(a) do if(ord(a[i])>max) then max:=ord(a[i]);
writeln(max-ord('0'));
for i:=1 to (max-ord('0')) do
begin
for j:=1 to length(a) do
begin
if(a[j]<>'0') then begin write('1'); ord(a[j]):=ord(a[j])-1; end
else
if(a[j]='0') then
if(j<>1) then  write('0')
else
delete(a,j,1);
end;
if(i=max-ord('0')) then writeln else write(' ');
end;
end.

var
 l,c,stn,i,j,n,m,k,kol,res:longint;
 ans,d,b,st,a:array[0..200000] of longint;
 s:string;
 f:integer;

procedure rec(q,k:longint);
var
 i:longint;
begin
 st[k]:=a[q];
 if k=j then
 begin
  for i:=1 to k do s:=s+chr(st[i]+48);
  val(s,c,f);
  inc(stn);
  b[stn]:=c;
  s:='';
  exit;
 end;
 for i:=1 to 2 do rec(i,k+1);
end;

procedure qsort(l,r:longint);
var
 i,j,t,m:longint;
begin
 i:=l;
 j:=r;
 m:=b[l+random(r-l+1)];
 repeat
  while b[i]<m do inc(i);
  while b[j]>m do dec(j);
  if i>j then break;
  t:=b[i];
  b[i]:=b[j];
  b[j]:=t;
  inc(i);
  dec(j);
 until i>j;
 if l<j then qsort(l,j);
 if i<r then qsort(i,r);
end;

begin
{ assign(input,'input.txt');
 reset(input);
 assign(output,'output.txt');
 rewrite(output);  }
 readln(n);
 a[1]:=0; a[2]:=1;
 for j:=1 to 6 do
 begin
  for i:=1 to 2 do rec(i,1);
 end;
 qsort(1,stn);
 for i:=1 to stn do if b[i]<>b[i+1] then
 begin
  inc(kol);
  d[kol]:=b[i];
 end;
 l:=kol;
 stn:=0;
 while true do
 begin
  if n=0 then break;
  if n-d[l]>=0 then
  begin
   dec(n,d[l]);
   inc(stn);
   ans[stn]:=d[l];
  end else dec(l);
 end;
 writeln(stn);
 for i:=1 to stn do write(ans[i],' ');
end.

var
 x,ti,l,c,stn,i,j,n,m,k,kol,res:longint;
 f,p,t,ans,d,b,st,a:array[0..2000000] of longint;
 s:string;
 fi:integer;

function min(a,b:longint):longint;
begin
 if a<b then min:=a else min:=b;
end;

procedure rec(q,k:longint);
var
 i:longint;
begin
 st[k]:=a[q];
 if k=j then
 begin
  for i:=1 to k do s:=s+chr(st[i]+48);
  val(s,c,fi);
  inc(stn);
  b[stn]:=c;
  s:='';
  exit;
 end;
 for i:=1 to 2 do rec(i,k+1);
end;

procedure qsort(l,r:longint);
var
 i,j,t,m:longint;
begin
 i:=l;
 j:=r;
 m:=b[l+random(r-l+1)];
 repeat
  while b[i]<m do inc(i);
  while b[j]>m do dec(j);
  if i>j then break;
  t:=b[i];
  b[i]:=b[j];
  b[j]:=t;
  inc(i);
  dec(j);
 until i>j;
 if l<j then qsort(l,j);
 if i<r then qsort(i,r);
end;

begin
{ assign(input,'input.txt');
 reset(input);
 assign(output,'output.txt');
 rewrite(output);  }
 readln(n);
 a[1]:=0; a[2]:=1;
 for j:=1 to 6 do
 begin
  for i:=1 to 2 do rec(i,1);
 end;
 qsort(1,stn);
 for i:=1 to stn do if b[i]<>b[i+1] then
 begin
  inc(kol);
  d[kol]:=b[i];
 end;
 f[0]:=0;
 for i:=1 to n do f[i]:=maxlongint div 2;
 t[0]:=1;
 for i:=0 to n do
 begin
  for j:=1 to kol do if t[i]>0 then if i+d[j]<=1000000 then
  begin
   t[i+d[j]]:=1;
   if f[i+d[j]]>f[i]+1 then
   begin
    f[i+d[j]]:=min(f[i+d[j]],f[i]+1);
    p[i+d[j]]:=i;
   end;
  end;
 end;
 x:=n;
 while x>0 do
 begin
  inc(ti);
  ans[ti]:=x;
  x:=p[x];
 end;
 writeln(ti);
 for i:=1 to ti do write(ans[i]-ans[i+1],' ');
end.

const
 mo=1000000007;
var
 a:array[1..11111] of longint;
 n,m,k,x,q,w,e,sum,l,r,xx,yy:int64;i,z,j:longint;
 s,cf:string;
function min(x,y:int64):int64;
begin if x<y then min:=x else min:=y;end;

function max(x,y:int64):int64;
begin if x>y then max:=x else max:=y;end;

begin
 readln(s);
 n:=length(s);
 for i:=1 to n do a[i]:=ord(s[i])-48;
 for i:=1 to n do if ord(s[i])-48>m then m:=ord(s[i])-48;
 writeln(m);
 for i:=1 to m do
 begin
  for j:=1 to n do
  begin if a[j]>0 then begin write('1');dec(a[j]);end else write('0');end;
  write(' ');
 end;
end.

var n,m,i,j,k,ans,l,r:longint;
    a,b:array[1..10000]of longint;
procedure rec(s:string);
var i,l,tt:longint;
 begin
   val(s,tt);
   if (tt>n) then exit;
   inc(m);
   a[m]:=tt;
   if s[length(s)]='0' then begin s[length(s)]:='1'; rec(s); end else
   if pos('0',s)=0 then
    begin
      l:=length(s);
      s:='1';
      for i:=1 to l do
       s:=s+'0';
      rec(s);
    end else
    begin
      l:=0;
      for i:=length(s) downto 1 do
       if s[i]='0' then begin l:=i; break; end;
      s[l]:='1';
      for i:=l+1 to length(s) do
       s[i]:='0';
      rec(s);
    end;
 end;
function get(l:longint):longint;
var r:longint;
 begin
   r:=0;
   while l mod 10=0 do
    begin
      inc(r);
      l:=l div 10;
    end;
   exit(r);
 end;
  begin
    read(n);
    rec('1');
    for i:=m downto 1 do
     begin
       while a[i]<=n do
        if (get(a[i])<>get(n)) then break else
        begin
          inc(r);
          b[r]:=a[i];
          n:=n-a[i];
        end;
     end;
    writeln(r);
    for i:=1 to r do
     write(b[i],' ');
    writeln;
  end.

var
 ff:array[1..1000]of longint;
 f:array[1..100,1..100]of longint;
 s,t:ansistring;
 k,h,i,j,n:longint;
begin
 readln(n);
 str(n,s);
 for i:=1 to length(s) do
 begin
  for j:=1 to ord(s[i])-48 do
  begin
   inc(f[i,j]);
   ff[j]:=1;
  end;
 end;
 for i:=9 downto 1 do if ff[i]=1 then
 begin
  n:=i;
  break;
 end;
 writeln(n);
 for i:=1 to n do
 begin
  t:='';
  for j:=length(s)downto 1 do
  begin
   if f[j,i]=0 then continue;
   t:=t+chr(f[j,i]+48);
  end;
  write(t,' ');

 end;
end.

var f1:text;nn,n,h,res,i,s:longint;
a:array[1..10000]of longint;
begin
        assign(f1,'');reset(f1);
        readln(f1,n);
        res:=0;
        while n<>0 do
        begin
                nn:=n;h:=0;
                while nn<>0 do
                begin inc(h);nn:=nn div 10;end;
                if h=1 then begin writeln(res+n);
                for i:=1 to res do write(a[i],' ');for i:=1 to n do write(1,' ');halt;end
                else begin
                s:=0;
                for i:=1 to h-1 do s:=s*10+1;
                if n mod 10=0 then s:=s*10 else s:=s*10+1;
                if n<s then begin s:=s div 100;
                if n mod 10=0 then s:=s*10 else s:=s*10+1;end;
                res:=res+1;a[res]:=s;n:=n-s;end;
        end;
        writeln(res);
        for i:=1 to res do write(a[i],' ');
end.

var s:ansistring; i,j,res,x:longint;
 a,b:array[0..1000000] of longint;
 begin
  read(x);
  for i:=1 to 8*8*2-1 do
   begin
   s:=binstr(i,7);
   for j:=1 to 7 do
   if s[j]='0' then  a[i]:=a[i]*10 else a[i]:=a[i]*10+1;
  end;

  While x>0 do
   begin
   for i:=8*8*2-1 downto 1 do
   if a[i]<=x then begin
    dec(x,a[i]);
    inc(res);
    b[res]:=a[i];
    break;
   end;
 end;
 writeln(res);
 for i:=1 to res do
 write(b[i],' ');
end.

 type niz=array[-1..1000000] of longint;
procedure sort(var a:niz;n:longint);
 var  i,h,s,f,l:longint;
begin

 for i:=2 to n do
  begin
   h:=a[i]; s:=i;f:=s div 2;
   while ((s>1) and (a[f]<h)) do
   begin
     a[s]:=a[f]; s:=f; f:=s div 2;
   end;
  a[s]:=h;
 end;
 for i:=n downto 2 do
  begin
   l:=a[i]; a[i]:=a[1]; f:=1;
   if ((i-1>=3) and (a[3]>a[2]))
     then s:=3 else s:=2;
   while (s<=i-1) and (a[s]>l) do
     begin
     a[f]:=a[s]; f:=s; s:=2*f;
     if ((s+1<=i-1) and (a[s+1]>a[s]))
         then s:=s+1;
     end;
   a[f]:=l;
  end;
end;
var
 s:ansistring; i,j,x,res:longint;
 a,b:niz;
 begin
  read(x);
  for i:=1 to 8*8*2-1 do
   begin
   s:=binstr(i,7);
   for j:=1 to 7 do
   if s[j]='0' then  a[i]:=a[i]*10 else a[i]:=a[i]*10+1;
  end;

 sort (a,8*8*2-1);

  While x>0 do
   begin
   for i:=8*8*2-1 downto 1 do
   if a[i]<=x then begin
    dec(x,a[i]);
    inc(res);
    b[res]:=a[i];
    break;
   end;
 end;
 writeln(res);
 for i:=1 to res do
 write(b[i],' ');
end.

var s:ansistring; i,j,res,x:longint;
 a,b:array[0..1000000] of longint;
 begin
  read(x);
  for i:=1 to 8*8 do
   begin
   s:=binstr(i,7);
   for j:=1 to 6 do
   if s[j]='0' then  a[i]:=a[i]*10 else a[i]:=a[i]*10+1;
  end;

  While x>0 do
   begin
   for i:=8*8-1 downto 1 do
   if a[i]<=x then begin
    dec(x,a[i]);
    inc(res);
    b[res]:=a[i];
    break;
   end;
 end;
 writeln(res);
 for i:=1 to res do
 write(b[i],' ');
end.

 type niz=array[-1..1000000] of longint;
procedure sort(var a:niz;n:longint);
 var  i,h,s,f,l:longint;
begin

 for i:=2 to n do
  begin
   h:=a[i]; s:=i;f:=s div 2;
   while ((s>1) and (a[f]<h)) do
   begin
     a[s]:=a[f]; s:=f; f:=s div 2;
   end;
  a[s]:=h;
 end;
 for i:=n downto 2 do
  begin
   l:=a[i]; a[i]:=a[1]; f:=1;
   if ((i-1>=3) and (a[3]>a[2]))
     then s:=3 else s:=2;
   while (s<=i-1) and (a[s]>l) do
     begin
     a[f]:=a[s]; f:=s; s:=2*f;
     if ((s+1<=i-1) and (a[s+1]>a[s]))
         then s:=s+1;
     end;
   a[f]:=l;
  end;
end;
var
 s:ansistring; i,j,x,res,q:longint;
 a,b:niz;
 begin
  read(x);
  for i:=1 to 8*8*2-1 do
   begin
   s:=binstr(i,7);
   for j:=1 to 7 do
   if s[j]='0' then  a[i]:=a[i]*10 else a[i]:=a[i]*10+1;
  end;

 sort (a,8*8*2-1);

  While x>0 do
   begin
   for i:=8*8*2-1 downto 1 do
   if (a[i]<=x ) and (q=0) then begin
    dec(x,a[i]);
    q:=1;
    inc(res);
    b[res]:=a[i];

   end;
   q:=0;

 end;
 writeln(res);
 for i:=1 to res do
 write(b[i],' ');
end.

var
  l, k: integer;
  n: longint;
  min, max, pos0: byte;
  found0: boolean;

function len(a: longint): integer;
var
  k: integer;
begin
  min := 10;
  max := 0;
  found0 := false;
  k := 0;
  while a > 0 do
  begin
    if a mod 10 = 0 then
    begin
      found0 := true;
      pos0 := k + 1;
    end
    else if (a mod 10 < min) then
      min := a mod 10;
    if (a mod 10 > max) then
      max := a mod 10;
    a := a div 10;
    inc(k);
  end;
  len := k;
end;

function pow10(a: byte): longint;
var
  k: longint;
  i: byte;
begin
  k := 1;
  for i := a downto 1 do
    k := k * 10;
  pow10 := k;
end;

function get11(a: byte): longint;
var
  k: longint;
  i: byte;
begin
  k := 0;
  for i := a downto 1 do
  begin
    k := k * 10;
    if not (found0 and (i = pos0)) then
      inc(k);
  end;
  get11 := k;
end;

begin
  readln(N);

  l := len(n);
  writeln(max);
  k := get11(l);
  while n >= k do
  begin
    n := n - k;
    write(k, ' ');
  end;

  while n > 0 do
  begin
    l := len(n);
    k := get11(l);
    while n >= k do
    begin
      n := n - k;
      write(k, ' ');
    end;
  end;
end.

var
  s, key: string;
  rd: boolean;
  l, k, l2: integer;
  c: char;
  n, n2, t: longint;

begin
  readln(N);

  while n <> 0 do
  begin
    n2 := n;

    l := 0;
    while n2 > 0 do
    begin
      inc(l);
      n2 := n2 div 10;
    end;

    l2 := l;
    k := 0;
    while l2 <> 0 do
    begin
      t := round(exp(ln(10) * (l2 - 1)));
      k := k + t;
      if k > n then
        k := k - t;
      dec(l2);
    end;

    while n >= k do
    begin
      n := n - k;
      write(k, ' ');
    end;
  end;
end.

var
  s, key: string;
  rd: boolean;
  l, k, l2,num: integer;
  c: char;
  n, n2, t: longint;
  a: array[1..10000] of longint;

begin
  readln(N);
  num := 0;
  while n <> 0 do
  begin
    n2 := n;

    l := 0;
    while n2 > 0 do
    begin
      inc(l);
      n2 := n2 div 10;
    end;

    l2 := l;
    k := 0;
    while l2 <> 0 do
    begin
      t := round(exp(ln(10) * (l2 - 1)));
      k := k + t;
      if k > n then
        k := k - t;
      dec(l2);
    end;

    while n >= k do
    begin
      n := n - k;
      inc(num);
      a[num] := k;
    end;
  end;

  writeln(num);
  for n := num downto 1 do
    write(a[n], ' ');
end.

var
  l, k: integer;
  n: longint;
  min, max, pos0: byte;
  found0: boolean;

function len(a: longint): integer;
var
  k: integer;
begin
  min := 10;
  max := 0;
  found0 := false;
  k := 0;
  while a > 0 do
  begin
    if a mod 10 = 0 then
    begin
      found0 := true;
      pos0 := k + 1;
    end
    else if (a mod 10 < min) then
      min := a mod 10;
    if (a mod 10 > max) then
      max := a mod 10;
    a := a div 10;
    inc(k);
  end;
  len := k;
end;

function pow10(a: byte): longint;
var
  k: longint;
  i: byte;
begin
  k := 1;
  for i := a downto 1 do
    k := k * 10;
  pow10 := k;
end;

function get11(a: byte): longint;
var
  k,n2: longint;
  i,j: byte;
begin
  k := 0;
  for i := a downto 1 do
  begin
    n2 := n;
    k := k * 10;
    for j := 1 to i-1 do
      n2 := n2 div 10;
    if n2 mod 10 <> 0 then
      inc(k);
  end;
  get11 := k;
end;

begin
  readln(N);

  l := len(n);
  writeln(max);
  k := get11(l);
  while n >= k do
  begin
    n := n - k;
    write(k, ' ');
  end;

  while n > 0 do
  begin
    l := len(n);
    k := get11(l);
    while n >= k do
    begin
      n := n - k;
      write(k, ' ');
    end;
  end;
end.

var
  s, key: string;
  rd: boolean;
  l, k, l2,num: integer;
  c: char;
  n, n2, t: longint;
  a: array[1..1000] of longint;

begin
  readln(N);
  num := 0;
  while n <> 0 do
  begin
    n2 := n;

    l := 0;
    while n2 > 0 do
    begin
      inc(l);
      n2 := n2 div 10;
    end;

    l2 := l;
    k := 0;
    while l2 <> 0 do
    begin
      t := round(exp(ln(10) * (l2 - 1)));
      k := k + t;
      if k > n then
        k := k - t;
      dec(l2);
    end;

    while n >= k do
    begin
      n := n - k;
      inc(num);
      a[num] := k;
    end;
  end;

  writeln(num);
  for n := 1 to num do
    write(a[n], ' ');
end.

uses math,sysutils;
var i,p,l,k,j,m,n,imain,t,x1,x2,y1,y2,jmain,u,y,len,l1,l2,r1,r2:longint;
    a,b:array[0..10000]of int64;
    s:string;

function trying(n:longint):boolean;
var i,j:longint;
begin
    for i:=1 to length(inttostr(n)) do
        if (inttostr(n)[i]<>'0')and
        (inttostr(n)[i]<>'1') then
        exit(false);
    exit(true);
end;

begin
    read(n);
    m:=n;
    while m<>0 do
    begin
        j:=m;
        while true do
        begin
            if trying(j) then
            begin
                inc(i);
                a[i]:=j;
                m:=m-j; break;
            end;
            dec(j);
        end;
    end;
    writeln(i);
    for j:=1 to i do
        write(a[j],' ');
end.

const
  oo=10000000;
var
  tr,t,a:array[0..1000000] of longint;
  j,i,n,d:longint;
function min(a,b:longint):longint;
  begin
    if a>b then exit(b) else exit(a);
  end;
procedure addso(x:longint);
  var  tg:longint;
  begin
    tg:=x;
    repeat
      if x mod 10>1 then exit;
      x:=x div 10;
    until x=0;
    inc(d);
    a[d]:=tg;
  end;
begin
  readln(n);
  for i:=1 to n do addso(i);
  for i:=1 to n do
    begin
      t[i]:=oo;
      for j:=1 to d do
        if i>=a[j] then
          begin
            t[i]:=min(t[i],t[i-a[j]]+1);
            tr[i]:=j;
          end
        else break;
    end;
  writeln(t[n]);
  repeat
    write(a[tr[n]],' ');
    n:=n-a[tr[n]];
  until n=0;
  readln;
end.

const
  oo=10000000;
var
  tr,t,a:array[0..1000000] of longint;
  j,i,n,d:longint;
function min(a,b:longint):longint;
  begin
    if a>b then exit(b) else exit(a);
  end;
procedure addso(x:longint);
  var  tg:longint;
  begin
    tg:=x;
    repeat
      if x mod 10>1 then exit;
      x:=x div 10;
    until x=0;
    inc(d);
    a[d]:=tg;
  end;
begin
  readln(n);
  for i:=1 to n do addso(i);
  for i:=1 to n do
    begin
      t[i]:=oo;
      for j:=1 to d do
        if i>=a[j] then
          begin
            if t[i]>t[i-a[j]]+1 then
              begin
                t[i]:=t[i-a[j]]+1;
                tr[i]:=j;
              end;
          end
        else break;
    end;
  writeln(t[n]);
  writeln(tr[n]);
  repeat
    write(a[tr[n]],' ');
    n:=n-a[tr[n]];
  until n=0;
  readln;
end.

var
 st:array[1..100000] of longint;
 n,i,w,x:longint;
 f:boolean;
begin
 readln(n);
 for i:=111111 downto 1 do
 begin
  x:=i;
  f:=false;
  repeat
   if (x mod 10=0)or(x mod 10=1) then else
   begin
    f:=true;
    break;
   end;
   x:=x div 10;
  until x=0;

  if (not f)and(n>=i) then
  begin
   while 81=81 do
   begin
    if n-i>=0 then dec(n,i) else break;
    inc(w);
    st[w]:=i;
   end;
  end;
 end;
 writeln(w);
 for i:=1 to w do write(st[i],' ');

end.

uses math;
var
 st,a:array[0..100000] of longint;
 n,i,w,x,kol,ma,mn,j,k,m:longint;
 f:boolean;
begin
 readln(n);
 m:=n;
 ma:=1;
 while n-10>=0 do
 begin
  inc(w);
  st[w]:=10;
  dec(n,10);
  inc(a[10]);
  ma:=10;
 end;
 for i:=1 to n do begin inc(w); st[w]:=1;inc(a[1]);end;
 while 81=81 do
 begin
  k:=0;
  for i:=ma downto 1 do
   for j:=ma downto 1 do if (a[i]<>0)and(a[j]<>0) then
   begin
    if (i=j)and(a[i]>=10)and(i*10<=m) then x:=i*10 else x:=i+j;
    f:=false;
    repeat
     if (x mod 10<>0)and(x mod 10 <>1) then
     begin
      f:=true;
      break;
     end;
     x:=x div 10;
    until x=0;

    if f then break else
    begin
      if (i=j)and(a[i]>=10)and(i*10<=m) then
      begin
       if i*10>ma then ma:=i*10;
       inc(a[i*10],a[i] div 10);
       dec(a[i],10*(a[i] div 10));
       k:=1;
      end else
      begin
       mn:=min(a[i],a[j]);
       if i+j>ma then ma:=i+j;
       inc(a[i+j],mn);
       dec(a[i],mn);
       dec(a[j],mn);
       k:=1;
      end;
    end;
   end;
   if k=0 then break;
 end;
 for i:=1 to ma do if a[i]<>0 then  inc(kol,a[i]);
 writeln(kol);
 for i:=1 to ma do if a[i]<>0 then
  for j:=1 to a[i] do write(i,' ');
end.

uses math;
var
 st,a:array[0..100000] of longint;
 n,i,w,x,kol,ma,mn,j,k,m,kk:longint;
 f:boolean;
begin
 readln(n);
 m:=n;
 ma:=1;
 while n-10>=0 do
 begin
  inc(w);
  st[w]:=10;
  dec(n,10);
  inc(a[10]);
  ma:=10;
 end;
 for i:=1 to n do begin inc(w); st[w]:=1;inc(a[1]);end;
 while 81=81 do
 begin
  k:=0;
  for i:=ma downto 1 do
   for j:=ma downto 1 do if (a[i]<>0)and(a[j]<>0) then
   begin
    if (i=j)and(a[i]>=10)and(i*10<=m) then x:=i*10 else x:=i+j;
    f:=false;
    repeat
     if (x mod 10<>0)and(x mod 10 <>1) then
     begin
      f:=true;
      break;
     end;
     x:=x div 10;
    until x=0;

    if f then break else
    begin
      if (i=j)and(a[i]>=10)and(i*10<=m) then
      begin
       kk:=10;
       while i*kk*10<=m do kk:=kk*10;
       if i*kk>ma then ma:=i*kk;
       inc(a[i*kk],a[i] div kk);
       dec(a[i],kk*(a[i] div kk));
       k:=1;
      end else
      begin
       mn:=min(a[i],a[j]);
       if i+j>ma then ma:=i+j;
       inc(a[i+j],mn);
       dec(a[i],mn);
       dec(a[j],mn);
       k:=1;
      end;
    end;
   end;
   if k=0 then break;
 end;
 for i:=1 to ma do if a[i]<>0 then  inc(kol,a[i]);
 writeln(kol);
 for i:=1 to ma do if a[i]<>0 then
  for j:=1 to a[i] do write(i,' ');
end.

Program plakat;
var i,n,y,x,j,d,s:LongInt;
    a: array[1..100] of Integer;
    b: array[1..100] of Integer;
    c: array[1..1000] of LongInt;
Begin
read(n);
i:=1;
repeat
a[i]:=n mod 10;
n:=trunc((n-n mod 10)/10);
i:=i+1;
until n=0;
y:=1;
repeat
for j:= i-1 downto 1 do
if a[j]>=1 then b[j]:=1 else b[j]:=0;
for j:= i-1 downto 1 do
Begin
d:=1;
if j>1 then
for x:=1 to j-1 do
d:=d*10
else d:=1;
c[y]:=c[y]+b[j]*d;
end;
for j:= i-1 downto 1 do
a[j]:=a[j]-b[j];
y:=y+1;
s:=0;
for j:= i-1 downto 1 do
s:=s+a[j];
until s=0;
for j:=1 to y-1 do
write(c[j],' ');
end.

const fi='';
      fo='';

var n,min:longint;
    s:string;
    a,b:array[0..10] of longint;
    f,g:text;

procedure doc;
begin
    readln(f,s);
end;

procedure chuanbi;
var i:longint;
begin
    n:=length(s);
    for i:=1 to n do
        begin
            a[i]:=ord(s[i])-48;
        end;
end;

procedure ghi;
var i,x,y,j:longint;
begin
    x:=1;y:=1;
    while x<=n do
        begin
            for i:=1 to n do b[i]:=0;
            min:=high(longint);
            for i:=x to n do
                begin
                    if a[i]>0 then b[i]:=1;
                    if (a[i]>0) and (a[i]<min) then min:=a[i];
                end;
            for i:=x to n do
                a[i]:=a[i]-b[i]*min;
            y:=n+1;x:=n+1;
            for i:=1 to n do
                if b[i]>0 then
                    begin
                        y:=i;break;
                    end;
            for i:=1 to n do
                if a[i]>0 then
                    begin
                        x:=i;break;
                    end;
            for i:=1 to min do
                begin
                    for j:=y to n do
                        write(g,b[j]);
                    write(G,' ');
                end;
        end;
end;

begin
    assign(f,fi);reset(f);
    assign(g,fo);rewrite(g);
        doc;
        chuanbi;
        ghi;
    close(f);close(g);
end.

var s:string;
    ans:array[1..100] of string;
    b:boolean;
    i,k,n,m:longint;
begin
readln(s);

b:=true;
while  b do
begin
 b:=false;
 inc(n);
 for i:=1 to length(s) do
  if s[i]='0'
  then ans[n]:=ans[n]+s[i]
  else begin
   b:=true;
   ans[n]:=ans[n]+'1';
   s[i]:=chr(ord(s[i])-1);
  end;
end;
writeln(n-1);
for i:=1 to n-1 do
 write(ans[i],' ');
end.

var s:string;
    ans:array[1..100] of string;
    b:boolean;
    i,k,n,m:longint;
begin
readln(s);
b:=true;
while  b do
begin
 b:=false;
 inc(n);
 for i:=1 to length(s) do
  if s[i]='0'
  then ans[n]:=ans[n]+s[i]
  else begin
   b:=true;
   ans[n]:=ans[n]+'1';
   s[i]:=chr(ord(s[i])-1);
  end;
end;
for i:=1 to n-1do
 write(ans[i],' ');
end.

var n,t,m,s:longint;
    a:array[0..1000000] of longint;

procedure process;
var i:longint;
    tmp:string;
begin
read(s);
str(s,tmp);
for i:=1 to length(tmp) do t:=t*10+1;
while s>0 do
    begin
    while s>=t do
        begin
        s:=s-t;
        inc(n);
        a[n]:=t;
        end;
    if t mod 10=0 then t:=t div 10 else t:=t-1;
    end;
writeln(n);
for i:=n downto 1 do write(a[i],' ');
end;

begin
process;
end.

var n,t,m,s:longint;
    a:array[0..1000000] of longint;

procedure process;
var i:longint;
    tmp,t2:string;
begin
read(s);
str(s,tmp);
for i:=1 to length(tmp) do t:=t*10+1;
while s>0 do
    begin
    while s>=t do
        begin
        s:=s-t;
        inc(n);
        a[n]:=t;
        end;
    str(s,tmp);
    t2:='1';
    for i:=2 to length(tmp) do
        if tmp[i]>'1' then t2:=t2+'1' else t2:=t2+'0';
    val(t2,t);
    end;
writeln(n);
for i:=n downto 1 do write(a[i],' ');
end;

begin
process;
end.

var  a,f,ans:array[0..1000] of longint;
     n,kol,x,g,p:longint;

procedure new_el;
	var h,s,k:longint;
begin
	s:=0;
	k:=1;
	for h:=n downto 1 do
		begin
			s:=s+k*a[h];
			k:=k*10;
		end;
   inc(kol);
   f[kol]:=s;
end;

procedure dv_perebor;
	var i,j:longint;
begin
	n:=7;
	fillchar(a,sizeof(a),0);
	a[n]:=1;
	while a[0] = 0 do
		begin
			new_el;
			i:=n;
			while a[i] = 1 do
				begin
					a[i]:=0;
					dec(i);
				end;
			a[i]:=1;
		end;
end;

begin
	readln(x);
	kol:=0;
	dv_perebor;
	p:=0;
	g:=kol;
	while x>0 do
		begin
			if f[g] > x 	then 	dec(g);
			if f[g] <= x	then 	begin
										x:=x-f[g];
										inc(p);
										ans[p]:=f[g];
									end;
		end;
	writeln(p);

	for g:=1 to p do
		write(ans[g],' ');
end.

program Contest300_B;
uses math;
const
        maxN=trunc(106);
var
        ff: text;
        n: longint;
        T,v,S: array[0..7] of longint;
        i,j,tmp,m,c: longint;

procedure swap(var a,b: longint);
  var   t: longint;
  begin
        t:=a;a:=b;b:=t;
  end;

begin
        readln(n);
        i:=0;
        while n<>0 do
          begin
                inc(i);
                T[i]:=n mod 10;
                v[i]:=i;
                S[i]:=max(1,S[i-1]*10);
                n:=n div 10;
          end;
        m:=i;
        for i:=1 to m do
          begin
           tmp:=i;
           for j:=i+1 to m do
                if (T[j]>T[tmp])  then tmp:=j;
           Swap(T[i],T[tmp]);
           Swap(v[i],v[tmp]);
          end;

        writeln(T[1]);
        tmp:=0;
        i:=1;
        while true do
        begin
             j:=i;
             repeat
                        tmp:=tmp+S[ v[j] ];
                        if (j<m)and(T[i]=T[j+1]) then inc(j);
             until  (j=m)or(T[j+1]<>T[j]);
             for c:=T[j+1]+1 to T[i] do write(tmp,#32);
             i:=j+1;
             if j=m then break;
        end;

end.

program Contest300_B;
uses math;
const
        maxN=trunc(106);
var
        ff: text;
        n: longint;
        T,v,S: array[0..7] of longint;
        i,j,tmp,m,c: longint;

procedure swap(var a,b: longint);
  var   t: longint;
  begin
        t:=a;a:=b;b:=t;
  end;

begin
        readln(n);
        i:=0;
        while n<>0 do
          begin
                inc(i);
                T[i]:=n mod 10;
                v[i]:=i;
                S[i]:=max(1,S[i-1]*10);
                n:=n div 10;
          end;
        m:=i;
        for i:=1 to m do
          begin
           tmp:=i;
           for j:=i+1 to m do
                if (T[j]>T[tmp])  then tmp:=j;
           Swap(T[i],T[tmp]);
           Swap(v[i],v[tmp]);
          end;
        for i:=1 to m do writeln(T[i],' ',v[i]);readln;
        writeln(T[1]);
        tmp:=0;
        i:=1;
        while true do
        begin
                j:=i;
             repeat
                        i:=j;
                        tmp:=tmp+S[ v[j] ];
                        if (j<m)and(T[i]=T[j+1]) then inc(j);
             until      (i=j)or(i=m);
             for c:=T[j+1]+1 to T[i] do write(tmp,#32);
             i:=j+1;
             if (j=m)or((j<m)and(T[j+1]=0)) then break;
        end;
        readln;
end.

const maxn = trunc(1e6);

var a,b:array[0..maxn] of longint;
    kol,l,r,ans,m,n,i:longint;

procedure tt(x:longint);
 begin
  if x > maxn then exit;
   inc(kol);
   a[kol]:=x;
    tt(x*10);
    tt(x*10+1);
 end;

procedure sort(l,r: longint);
 var i,j,x,y: longint;
  begin
   i:=l; j:=r;
   x:=a[l+random(r-l)];
   repeat
    while a[i]<x do inc(i);
    while x<a[j] do dec(j);
     if not(i>j) then begin
      y:=a[i]; a[i]:=a[j]; a[j]:=y;
      inc(i); j:=j-1;
     end;
   until i>j;
    if l<j then sort(l,j);
    if i<r then sort(i,r);
  end;

 begin
  tt(1);
   sort(1,kol);
   read(n);
    while n>0 do
     begin
      l:=1;
      r:=kol;
       while l+1<r do
        begin
         m:=(r+l) >> 1;
          if a[m]>n then r:=m else l:=m;
        end;
         if a[r]<=n then l:=r;
          inc(ans);
          b[ans]:=a[l];
          dec(n,a[l]);
     end;

      writeln(ans);
       for i:=1 to ans - 1 do write(b[i],' '); writeln(b[ans]);

 end.

const fi = '';
      fo = '';

var n, x, cnt: int64;
    i: longint;
    code: integer;
    ans: array [1..10000000] of int64;

begin
 assign(input, fi); reset(input);
 assign(output, fo); rewrite(output);

 readln(n);
 for i:=65537 downto 1 do
  begin
   val(binstr(i, 17), x, code);
   while n >= x do
    begin
     n:=n-x;
     inc(cnt);
     ans[cnt]:=x;
    end;
  end;

 writeln(cnt);
 for i:=1 to cnt do write(ans[i], ' ');

 close(input); close(output);
end.

const fi = '';
      fo = '';

var n, x: int64;
    s, t: string;
    code: integer;
    i, k, cnt: longint;
    ans: array [1..100] of string;

begin
 assign(input, fi); reset(input);
 assign(output, fo); rewrite(output);

 readln(n);
 str(n, s); k:=length(s);
 while true do
  begin
   t:='';
   for i:=1 to k do
    if s[i] > '0' then
     begin
      t:=t+'1';
      s[i]:=chr(ord(s[i])-1);
     end
    else t:=t+'0';
   inc(cnt); ans[cnt]:=t;

   val(s, x, code);
   if x = 0 then break;
  end;
 {for i:=65537 downto 1 do
  begin
   val(binstr(i, 17), x, code);
   while n >= x do
    begin
     n:=n-x;
     inc(cnt);
     ans[cnt]:=x;
    end;
  end;}

 writeln(cnt);
 for i:=1 to cnt do write(ans[i], ' ');

 close(input); close(output);
end.

const fi = '';
      fo = '';

var n, x, cnt: int64;
    i: longint;
    code: integer;
    ans: array [1..10000000] of int64;

begin
 assign(input, fi); reset(input);
 assign(output, fo); rewrite(output);

 readln(n);
 for i:=65535 downto 1 do
  begin
   val(binstr(i, 16), x, code);
   while n >= x do
    begin
     n:=n-x;
     inc(cnt);
     ans[cnt]:=x;
    end;
  end;

 for i:=1 to cnt do write(ans[i], ' ');

 close(input); close(output);
end.

const maxn = 1000010;
var n, i, res: longint;
    ans: array [0..maxn] of longint;
function check(k: longint): boolean;
var j: longint;
    s: string;
begin
	str(k, s);
	for j:=1 to length(s) do
		if ((s[j] <> '1') and (s[j] <> '0')) then exit(false);
	exit(true);
end;
begin
	read(n);
	i := n;
	while (n > 0) do
		begin
		while ((check(i)) and (i <= n)) do
			begin
			inc(res);
			ans[res] := i;
			n := n - i;
			end;
		dec(i);
		end;
	writeln(res);
	for i:=1 to res do write(ans[i], ' ');
end.