var
  n, k, i, t: longint;
  p: string;
  err: integer;

begin
  readln(n);
  str(n, p);
  val(p[1], k, err);
  t := k + 1;
  for i := 1 to length(p) - 1 do
  begin
    t := t * 10;
  end;
  writeln(t - n);
end.

   const eps=0.00000001;  besk1=200000008;  nn=200000;
   label 1,2;
    type   { real=double;}  {string=ansistring;}
    mas=array [0..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 i2,q,t,pos,x,y,z,pmax,imax,p1,p2,p3,p4,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1,besk:int64;
    newnapx,newnapy,napx,napy,p,time,pp,jj,step, k,ii,i,tt,j:longint;
     aa,bb,cc:double;
     aold,b,a:array[-10..2000000] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   prost,zanx,zany:array[-10..2000000] of boolean;
    sss, ss1,ss2:string;
     fl:array[0..200] of boolean;
    ss:string;ch:char;
    pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    function al(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;
     al:=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;

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

  read(p);
  t:=1;
  repeat t:=t*10 until t>p;
  t:=t div 10;
  q:=(p)  div t;
  write((q+1)*t-p);

   1:          close(output);
end.

var
  a,b,c,n,i:longint;
 begin
   readln(n);
   if n=1000000000 then begin writeln(1000000000);halt;end;
    a:=1;
    c:=n;
    b:=0;
   while n<>0 do
    begin
     n:=n div 10;
     a:=a*10;
    end;
    a:=a div 10;
   for i:=1 to a do
    begin
     c:=c+1;
     b:=b+1;
     if (c mod a=0) then begin writeln(b); halt; end; end;
 end.

var k,del,currentYear:integer;

begin
k:=1;
del:=1;
readln(currentYear);
if (currentYear>=1) and (currentYear<10) then
 writeln(1)
else if currentYear>=10 then
  begin
    while k<>0 do
     begin
     del:=del*10;
      if (currentYear div del)<10 then
      begin
        k:=0;
     end;

  end;
  if ( ( ( (currentYear div del)+1) * del)-currentYear)<1000000000 then
    writeln( ( ( (currentYear div del)+1) * del)-currentYear)
  else
  writeln(1000000000);
 end;

end.

Program qq;
var n,i,s,m:integer;
begin
s:=1;
read(n);
m:=n;
while (m>9) do begin
s:=s*10;
m:=m div 10;
end;
i:=n+s-(n mod s);
write(i-n);
end.

//const
  //  fi='LUCKYYEAR.INP';
 //   fo='LUCKYYEAR.OUT';
var n,dem,cnt,res:longint;
procedure nhap;
//var// f:text;
begin
  //  assign(f,fi);reset(f);
    readln(n);
  //  close(f);
end;
function sochuso(l:longint):longint;
var k:longint;
begin
    dem:=0;
    while l>0 do
    begin
        k:=l mod 10;
        if k>0 then
        begin
            inc(dem);
        end;
        l:=l div 10;
    end;
    exit(dem);
end;
function sohang(l:longint):longint;
begin
    cnt:=0;
    while l>0 do
    begin
        inc(cnt);
        l:=l div 10;
    end;
    exit(cnt);
end;
procedure xuat;
var //f:text;
    m,k,i:longint;
begin
  //  assign(f,fo);rewrite(f);
    res:=1;
    for i:=1 to sohang(n)-1 do res:=res*10;
    if sochuso(n)>1 then
    begin
        k:=n div res+1;
        m:=(k*res)-n;
        writeln(m);
        readln;
    end
    else
    begin
        writeln(res);
        readln;
    end;
   // close(f);
end;
begin
    nhap;
    xuat;
end.

var n , du , tmp : int64;

begin
   readln(n);
   du := 1;
   tmp := n;
   while tmp >= 10 do
      begin
      du := du*10;
      tmp := tmp div 10;
      end;
   du := du + (n div du) * du;
   writeln(du-n);
end.

uses math;
const fi='';
      fo='';
var s:string;
    n,r:longint;
begin
        assign(input,fi); reset(input);
        assign(output,fo); rewrite(output);
        readln(n);
        if n<9 then
                r:=n+1
        else
                begin
                        str(n,s);
                        r:=ord(s[1])-47;
                        r:=r*10**(length(s)-1);
                end;
        writeln(r-n);
        close(input);
        close(output);
end.

const
        fi='';
        fo='';
procedure fileio;
begin
        assign(input,fi); reset(input);
        assign(output,fo); rewrite(output);
end;
procedure enter;
var     s:string;
        n,so,i:longint;
begin
        readln(s);
        val(s,n);
        if s[1]='9' then
         begin
                so:=1;
                for i:=1 to length(s) do
                 so:=so*10;
         end
        else
         begin
                so:=ord(s[1])+1-48;
                for i:=1 to length(s)-1 do
                 so:=so*10;
         end;
        write(so-n);
end;
begin
        fileio;
        enter;
end.

Program One;
var i, j: integer;
g, n, k: int64;
a: array[1..100] of int64;

begin
	k:=1; n:=1;
	for i:=0 to 8 do begin
	 for j:=1 to 9 do
	  begin
  	 a[n]:= j*k;
  	 Inc(n);
 	 end;
	 k:=k*10;
	end;
	a[n]:=1000000000;
	a[n+1]:=2000000000;

//	for i:=1 to 82 do writeln(a[i]);

	readln(g);
	i:=1;
	while g >= a[i] do Inc(i);

	writeln(a[i]-g);

end.

var
s:string;
ch:int64;
n,i:longint;

begin
readln(n);
str(n,s);

ch:=ord(s[1])-47;
for i:=2 to length(S) do ch:=ch*10;
writeln(ch-n);
end.

//const fi='number.inp';
//      fo='number.out';
var d,s,n,x:longint;
//procedure mo;
//begin
//        assign(input,fi);
//        reset(input);
//        assign(output,fo);
//        rewrite(output);
//end;

procedure nhap;
begin
        readln(n);
end;

procedure xuly;
begin
        x:=n;
        if n < 10 then
        begin
                write(1);
                exit;
        end;
        s:=1;
        while x >= 10 do
        begin
                x:=x div 10;
                s:=s*10;
        end;
        write(s-(n-(x*s)));
end;

begin
  //      mo;
        nhap;
        xuly;
end.

var
n,i,j,k,x:longint;
begin
   readln(n);
   if n<10 then writeln(1) else begin
   k:=1;
   j:=n;
   x:=0;
   while j>=10 do begin
      j:=j div 10;
      k:=k*10;
   end;
      writeln((j+1)*k-n);
   end;
end.

var     n,a:int64;

begin
        readln(n);
        a:= 10;
        while a<=n do a:= a*10;
        a:= a div 10;
        a:= a+a*(n div a);
        write(a-n);
end.

{$Q-}
const   fi='';
        base=37;
        modp=trunc(1e9+7);
        maxlen=100000;
var
        ordc:array['0'..'z'] of int32;
        hash,p,d:array[0..maxlen] of int64;
        s:ansistring; n,res:int32;
procedure initHash;
var i:int32;
begin
        hash[0]:= 0;
        for i:= 1 to n do hash[i]:= (hash[i-1]*base+ordc[s[i]]) mod modp;
        p[0]:= 1;
        for i:= 1 to n do p[i]:= (p[i-1]*base) mod modp;
end;
function getHash(l,r:int32):int64;
var tmp:int64;
begin
        tmp:= (hash[r]-int64(hash[l-1])*p[r-l+1]) mod modp;
        if tmp<0 then inc(tmp,modp);
        exit(tmp);
end;
function check(len,last:int32):boolean;
var i:int32;
begin
        for i:= 1 to last div len-1 do
                if getHash(1,len)<>getHash(i*len+1,(i+1)*len) then exit(false);
        exit(true);
end;
procedure solve;
var i,j:int32; flag:boolean;
begin
        fillchar(d,sizeof(d),0);
        res:= 1;
        for i:= 2 to n do
        if (d[i]>=0) and (n mod i=0) then
        begin
                flag:= true;
                if d[i]=0 then
                        if check(n div i,n) then d[i]:= 1
                        else
                        begin
                                d[i]:= -1;
                                flag:= false;
                        end;
                for j:= i to n div i do
                if (d[i*j]=0) and (n mod (i*j)=0) then
                begin
                        if flag and check(n div(i*j),n div i) then
                                d[i*j]:= 1
                        else d[i*j]:= -1;
                end;
        end;
        for i:= n downto 1 do
        if d[i]=1 then
        begin
                res:= i;
                break;
        end;
end;
procedure process;
var i:int32;
begin
        assign(input,fi); reset(input);
        readln(s);
        while s<>'*' do
        begin
                n:= length(s);
                initHash;
                solve;
                writeln(res);
                readln(s);
        end;
        close(input);
end;
procedure init;
var c:char;
begin
        for c:= 'a' to 'z' do ordc[c]:= ord(c)-ord('a');
        for c:= '0' to '9' do ordc[c]:= ord(c)-ord('0')+26;
end;
begin
        init;
        process;
end.

var n,x,k,dem,i:longint;
procedure       mo;
begin
        assign(input,'808A.inp');reset(input);
        assign(output,'808A.out');rewrite(output);
end;
procedure       dong;
begin
        close(input);close(Output);
end;
procedure       nhap;
begin
        readln(n);
end;
procedure       xuli;
begin
        x:=n;
        repeat
                k:=x mod 10;
                x:=x div 10;
                inc(dem);
        until x=0;
        if n<=9 then writeln(1) else
        begin
        x:=k+1;
        for i:=1 to dem-1 do
                x:=x*10;
        writeln(x-n);
        end;

end;
begin
       // mo;
        nhap;
        xuli;
       // dong;
end.

var
n,l,i,j,p:int64;
begin
read(n);
i:=n;
p:=1;
while i>9 do
begin
i:=i div 10;
l:=l+1;
end;
while j<l do
begin
p:=p*10;
j:=j+1;
end;
write((p*(i+1))-n);
end.

var n,dem,k:longint;
begin
        read(n);
        k:=n;
        if n<10 then write(1)
        else begin
        dem:=1;
        repeat
        n:=n div 10;
        dem:=dem*10;

        until n<10;
        write((n+1)*dem-k);
        end;
end.

program n1;
var n, i, y,s, t, dr, kon, l: integer;
begin
readln (n);
l:=n;
repeat
    n:=n div 10;
    if n<>0 then s:=s+1;
until n=0;
t:=1;
while i<>s do begin
t:=10*t;
i:=i+1; end;
if l>9 then dr:=(l div t)+1;
i:=dr*t;
if i<>0 then kon:=i-l;
if i=0 then  kon:=1;
writeln (kon);
end.

var
n,k,b:int64;
begin
read(n);k:=10;
if n<10 then begin write(1);exit;end;
while n div k <>0 do k:=k*10;
k:=round(k/10);b:=k;k:=((n div k)+1)*b;
write(k-n);
end.

var n,c:int64;
a,b,i:int64;
begin
read(a);
n:=a;
b:=1;
while a>=10 do
 begin
  a:=a div 10;
  b:=b*10;
 end;
b:=b*(a+1);
write(b-n);
end.

var
    n, k, tmp: longint;
begin
    readln(n);
    k:=n;
    while k <> 0 do
        begin
            tmp:=k mod 10;
            k:=k div 10;
        end;
    tmp:=tmp + 1;
    while tmp - n <= 0 do
        tmp:=tmp * 10;
    writeln(tmp - n);
end.

var n,k,a,i:longint;

begin
 readln(n);
 a:=n;
 k:=0;
 while (n div 10 <>0) do
  begin
   k:=k+1;
   n:=n div 10;
  end;
 n:=n+1;
 for i:=1 to k do
  n:=n*10;
 writeln(n-a);
end.

program Matfey;
var
x1,x2,x3,x4,x5,i,x6,x9,x8,x10,j,k,d,x7,x11,x12 : longint;
s1,s2,s3,s4,s5 : string;
c1,c2,c3,c4,c5 : char;
i1,i2 : integer;
r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,a,b : real;
a1,a2 : array[0..10000000] of longint;
begin
 {
assign(input,'input.txt'); reset(input);
assign(output,'output.txt'); rewrite(output);
}
readln(s1);
val(s1,x2,i1);
val(s1[1],x1,i1);
x3:=x1+1;

for i:=1 to length(s1)-1 do
x3:=x3*10;

writeln(x3-x2);
   {
close(input); close(output);
  }
end.

var n,i,o,k,l,n1:longint;
a:array[1..10] of integer;
begin
read(n); k:=0; l:=0; n1:=n;
if n>9 then
while n<>0 do
begin
k:=K+1;
a[k]:=n mod 10;
n:=n div 10;
if a[k]<>0 then l:=L+1;
end
else o:=1;
if o<>1 then
begin
l:=a[k]+1;
for i:=1 to k-1 do
l:=l*10;
write(l-n1)
end
else write(o);
end.

var n,n2,raz:longint; kolz,i,k:byte;
begin
  readln(n); n2:=n; kolz:=0;
  if n>9 then
    begin
      while n>9 do begin inc(kolz); n:=n div 10; end;
      inc(n);
      for i:=1 to kolz do n:=n*10;
      raz:=n-n2;
    end
    else raz:=1;
  write(raz);

end.

uses math;
var n,m:int64;
    a:array[0..100100]of longint;
    s:string;
    flag:boolean;
    c:char;

begin
readln(n);
m:=1;
while n>=10*m do m:=m*10;
writeln(m-n mod m);
end.

if n<10 then begin writeln(1);halt;end;
if n<100 then begin writeln(10-n mod 10);halt;end;
if n<1000 then begin writeln(100-n mod 100);halt;end;
if n<10000 then begin writeln(1000-n mod 1000);halt;end;
if n<100000 then begin writeln(10000-n mod 10000);halt;end;

end.

var n,temp,t,x:int64;
begin
  readln(n);
  temp:=n;t:=1;
  while temp>0 do begin
    x:=temp mod 10;
    temp:=temp div 10;
    t:=t*10;
  end;
  t:=t div 10;
  writeln(((x+1)*t-n));
end.

var     o,n,i,j:int32;
        k,s:string;
        f:text;
begin
        assign(f,'');
        reset(f);
        readln(f,n);
        str(n,s);
        begin
                if (length(s)=1) and (n<=5) then
                        begin
                                 write(1);
                                 readln;
                                 halt;
                        end
                else if (length(s)=1) and (n<=10) then
                        begin
                                write(1);
                                readln;
                                halt;
                        end;

                if s[1]='9' then
                        begin
                                s:=s+'0';
                                s[1]:='1';
                                k:=s[1];
                                for i:=2 to length(s) do k:=k+'0';
                                val(k,o);
                                write(o-n);
                                readln;
                                halt;
                        end
                else
                k:=chr(ord(s[1])+1);
                for j:=2 to length(s) do k:=k+'0';
                val(k,o);
                write(o-n);
                readln;
                halt;
        end;
        close(f);
end.

Program Z1;
   var
      i, s, m, kod: longint;
      n: string;
Function pow( a:longint; b:longint ):longint;
var
   i, m: longint;
Begin
     m := a;
     for i:= 1 to b - 1 do
     a:= m * a;
     pow := a;

end;
Begin
read( n );
val( n, m, kod );
if(m = 0) or (m = 1) or (m = 2) or (m = 3) or (m = 4) or (m = 5) or (m = 6) or (m = 7) or (m = 8) or (m = 9) then
s := 1
else
Begin
i := m mod pow(10, length( n ) - 1);
s := pow(10, length( n ) - 1) - i;
end;
writeln( s );

end.

var n,i,res:longint; s:string;
begin
    readln(s);
    for i:=1 to length(s) do n:=n*10+ord(s[i])-48;
    if n<10 then begin write(1); exit; end;
    res:=ord(s[1])-48+1;
    for i:=1 to length(s)-1 do res:=res*10;
    write(res-n);
end.

var n,i,res:longint; s:string;
begin
    readln(s);
    for i:=1 to length(s) do n:=n*10+ord(s[i])-48;
    if n<5 then begin write(1); exit; end;
    res:=ord(s[1])-48+1;
    for i:=1 to length(s)-1 do res:=res*10;
    write(res-n);
end.

Uses sysutils;
var currentYear, afterYear, count:int64;
	i,firstnum:longint;
	s:string;
begin
	assign(input,''); reset(input);
	assign(output,''); rewrite(output);
	readln(s);
	currentYear:= strtoint(s);
	if currentYear <= 9 then write(1)
	else
	begin
		count:=1;
		for i:=2 to length(s) do count:=count*10;
		firstnum:= currentYear div count;
		afterYear:= (firstnum+1)*count;
		write(afteryear- currentYear);
	end;
	close(input); close(output);
end.

Program z1;
var n,a,b:longint;
begin
read(n);
a:=1;
b:=n;
while b>=10 do
begin
b:=b div 10;
a:=a*10;
end;
a:=a*(b+1);
a:=a-n;
write(a);
end.

program anulfericit1;
var n,s:string;
   i,b,c,j:integer;
begin
  readln(c);j:=c;
  str(c,s);
  b:=1;
  for i:=1 to length(s)-1 do b:=b*10;
  while(c>=10) do begin
  c:=c div 10;
  end;
  b:=b*(c+1);
 b:=b-j;
  writeln(b);
  readln;
end.

var  x,y,n:longint;
     st:string;
function lt(x:longint;y:integer):longint;
var tam:longint;
begin
        if (y=0) then exit(1);
        if (y=1) then lt:=x
        else
                begin
                    tam:= lt(x, y div 2) ;
                    if (y mod 2=0) then exit(tam*tam)
                    else exit(tam*tam*x);
                end;
end;
begin
        readln(st);
        val(st,n,y);
        val(st[1],x,y);
        inc(x);
        x:=x*lt(10,length(st)-1);
        write(x-n);
end.

var
  i,n,ans,k,t:longint;
begin
  readln(n);
  ans:=1;t:=1;n:=n+1;
  while n mod 10<>n do
  begin
    k:=n mod 10;
    if k<>0 then
    begin
      ans:=ans+(10-k)*t;
      n:=n+10-k;
    end;
    t:=t*10;n:=n div 10;
  end;
  writeln(ans);
  readln;readln;
end.

Program LuckyYear;
uses math;
var s,st:string; n,i,a,b,code:longint;
Procedure Next;
begin   str(n,s);
        val(s[1],b,code);
        b:=b+1; str(b,st);
        if s[1]='9' then
        begin   delete(s,1,1);
                s:='1'+s;
                for i:=2 to length(s) do s[i]:='0';
                s:=s+'0';
        end else
        begin   delete(s,1,1);
                s:=st+s;
                for i:=2 to length(s) do s[i]:='0';
        end;
        val(s,a,code);
        writeln(a-n);
end;
begin   //assign(input,'808A.inp'); reset(input);
        //assign(output,'808A.out'); rewrite(output);
        readln(n);
        Next;
        //close(input); close(output);
end.

var n,m,k: int64;
BEGIN
  readln(n);
  k:=1; m:=n;
  while m > 0 do
    begin
      k:=k*10;
      m:=m div 10;
    end;
  k:=k div 10;  m:=k;
  while k <= n do inc(k,m);
  write(k - n);
END.

program year;
var y,cur,t:longint;
begin
    read(y);
    t:=y;
    cur:=1;
    while y>9 do
    begin
        cur:=cur*10;
        y:=y div 10;
    end;
    writeln((y+1)*cur-t);
end.

  var
	FY,LY:longint;
	i:longint;
	long:longint;
function FN(Num:longint):longint;
begin
	while (Num div 10)<>0 do
	begin
		Num:=Num div 10;
		long:=long+1;
	end;
	exit(Num);
end;
function Power(x,q:longint):longint;
var t:longint;
begin
	if q=1 then exit(x);
	t:=Power(x,q div 2);
	if (q mod 2)=0 then exit(t*t) else exit(t*t*x);
end;
begin
	readln(FY);
	if (FY<10)  then LY:=FY+1
        else
        begin
	        if (FY mod 10)=0  then LY:=(FN(FY)+1)*Power(10,long)
                else
	                if (FY mod 10)<>0 then LY:=(FN(FY)+1)*Power(10,long);
        end;
	writeln(LY-FY);
end.

Program Educround21codefN1;
Uses math;
Var s: string;
    n, x, i, z: longint;

Begin

 Readln(s);
 z:= 0;
 val(s, n);

 For i:=1 to length(s) do begin
  if s[i] = '0' then inc(z);
 End;

 if length(s) = 1 then begin
  writeln(1);
  halt;
 end;

 if z = length(s)-1 then begin
  writeln( round( intpower(10, length(s)-1) ) );
 end
 else begin
  val(s[1], x);
  writeln( ((x + 1)*round( intpower(10, length(s)-1) ) ) - n );
 end;

End.

program zzz;
        var x,x1,z:longint;
            k: integer;

begin
     readln(x);
     if(x<10) then
              writeln('1');
     if(x>=10) then
     begin
          x1:=x;
          k:=0;
          while x1>0 do
          begin
               inc(k);
               x1:=x1 div 10;
          end;
          z:=1;
          while k>1 do
          begin
                z:=z*10;
                dec(k);
          end;
          x1:= x div z;
          x1:= (x1+1)*z;
          writeln(x1-x);
     end;
end.

program z1;
  var x,x1,k:longint;
      z:integer;
begin
  readln(x);
  k:=0;
  if x<10 then
    writeln('1')
  else
  begin

  x1:=x;
  while x1>0 do
  begin
    inc(k);
    x1:=x1 div 10;
  end;
  z:=1;
  while k >1 do
  begin
    z:=z*10;
    dec(k);
  end;
  x1:=x div z;
  x1:=(x1+1)*z;
  writeln(x1-x);
  end;
end.

var
 n, i, tmp1:longint;
 s, o:string;

begin
 read(n);
 str(n, o);
 s:= '';
 if o[1] = '9' then
  begin
   s:= s + '1';
   for i:= 1 to length(o) do
    s:= s + '0';
   val(s, tmp1);
   writeln(tmp1 - n);
   halt;
  end;

 s:= s + char(ord(o[1]) + 1);
 if n < 10 then begin writeln('1'); halt; end;
 for i:= 1 to length(o) - 1 do
  s:= s + '0';
 val(s, tmp1);
 writeln(tmp1 - n);
end.

program p1;
var
a1 : array [1..100001]  of longint;
x1,x2,x3,x4,x5,i,j : longint;
s1 : string;
ii : integer;

begin

readln(x1);
  {
for i:=1 to 1000000000 do
begin
x1:=x1+1;

str(x1,s1);
x3:=0;
 for j:=1 to length(s1) do
     if s1[j]<>'0' then x3:=x3+1;

 if x3=1 then begin writeln(i); exit;  end;

end;
  }

  str(x1,s1);
  val(s1[1],x2,ii);
  x2:=x2+1;
  for j:=1 to length(s1)-1 do
   x2:=x2*10;

   writeln(x2-x1);
end.

program Lucky_year;
var
        s: string;
        s1: string;
        code, code1, i: integer;
        k: int64;
        year, j, a: int64;

begin
        read(s);
        j:= 1;
        if length(s) = 1 then
                writeln(1)
        else
        begin
                val(s, a, code1);
                for i:= length(s) downto 1 do
                begin

                        if i=1 then
                        begin
                                val(s[1], k, code)
                        end;
                end;

                for i:= 1 to length(s)-1 do
                begin
                        j:= j*10;
                end;

                year:= (k+1)*j-a;
                write(year);
        end;
        readln;
        readln;
end.

var n,t,i:longint; s:string;
begin
  read(n); str(n,s); t:=1;
  for i:=1 to length(s)-1 do t:=t*10;
  write(((n div t)+1)*t-n)
end.

var n,j:integer;
  j1,k,i,j2:integer;
begin
  k:=0;
  read(n);
  if n < 10 then
  begin
    i := 2;
    while j <> 1 do
    begin
      if n < i then
      begin
        k := i-n;
        j := 1;
      end else
        i := i+1;
    end;
  end;
  if n >= 10 then
  begin
    j2 := 10;
    j1 := 10;
    while j <> 1 do
    begin
      if n < j2 then
      begin
        k := j2-n;
        j := 1;
      end else
        j2 := j2+j1;
      if j2 >= j1*10 then
        j1:=j1*10;
    end;
  end;
  write(k);
end.

uses math;

var
  n,k,m,ans:longint;

begin
  read(n);
  k:=round(int(log10(n)));
  m:=round(power(10,k));
  ans:=(n+m-1) div m * m-n;
  if ans=0 then
    begin
      inc(n);
      k:=round(int(log10(n)));
      m:=round(power(10,k));
      ans:=(n+m-1) div m * m-n;
      inc(ans)
    end;
  writeln(ans)
end.

var n:longint;s:string;l,f,i,lucky:longint;
begin
	readln(n);
	str(n,s);
	l:=length(s)-1;
	f:=(ord(s[1])-48)+1;
        lucky:=f;
	for i:=1 to l do
		lucky:=lucky*10;
	writeln(lucky-n);
end.

var a,b:int64; i,k:longint; sta,stb:string;
begin
        readln(a);
        str(a,sta);
        stb:='';
        if sta[1]<'9' then
                begin
                stb:=stb+chr(ord(sta[1])+1);
                for i:=1 to length(stA)-1 do stB:=stb+'0';
                end
        else
                begin
                stb:=stb+'1';
                for i:=1 to length(stA) do stb:=stb+'0'
                end;
        val(stb,b,k);
        writeln(b-a);
end.

const tfi = '';
tfo = '';
var cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi,y,p,t);
end;
procedure xuly;
begin
t:=y;
cur:=1;
while y>9 do
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

var a,q,x,l:LongInt;
    s:string;
    g:real;
begin
readln(a);
str(a,s);
l:=length(s);
g:=exp(ln(10)*(l-1));
x:=trunc(g);
q:=x-(a mod x);;
writeln(q);
end.

program sd;
var s:string;
b,x,k,bn,n,i:integer;
begin
read(s);
val(s,b,x);
k:=length(s);
n:=1;
for i:= 2 to k do
n:= n * 10;
bn:=b div n ;
write((n+(n*bn))-b);
end.

var p,a,k:longint;
begin
read(a);
k:=1;
p:=a;
if a<=9 then write (1) else begin
repeat
k:=k*10;
a:=a div 10

until a div 10=0;
write((a+1)*k-p);
end;
end.

Uses math;
Var fi, fo: text;
    n, i, long, tmp, k: Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, n);
	if (n div 10)=0 then
	begin
		writeln(fo, 1);
		close(fi); close(fo);
		exit;
	end;
	long:= trunc(log10(n)) + 1;
	k:= 1;
	for i:=1 to long-1 do k:= k*10;
	tmp:= n div k;
	writeln(fo, (tmp+1)*k - n);
	close(fi); close(fo);
End.

var x,y,n,i,t1:longint;
    t:qword;

function lt(x,y:longint):qword;
        var i:longint;
            s:qword;
        begin
        s:=1;
        for i:=1 to y do s:=s*x;
        exit(s);
        end;

begin
readln(n);
IF n<10 then
        begin
        write(1);
        exit;
        end;
x:=0;
t1:=n;
while n>0 do
        begin
        n:=n div 10;
        inc(x);
        end;
t:=t1 div lt(10,(x-1));
inc(t);
for i:=1 to x-1 do
        t:=t*10;
write(t-t1);
end.

var
   n,i,k,m,j:longint;
   a,b:array[1..100] of longint;
begin
   readln (n);
   i:=n;
   k:=0;
   j:=1;
   while i>0 do
   begin
      a[j]:=i mod 10;
      i:=i div 10;
      inc(k);
      inc(j);
   end;
   dec(j);
   if k=1 then begin writeln (1); exit; end;
   for i:=1 to j-1 do
   begin
      b[i]:=10-a[i];
      inc(a[i+1]);
   end;
   k:=a[i+1];
   for i:=j-1 downto 1 do k:=k*10;
   writeln (k-n);
end.

var     n:longint;

procedure nhap;
begin
	readln(n);
end;

procedure xuli;
var	q:qword;
	s,n1:longint;
begin
	q:=1;
        n1:=n;
	while n1 div 10 <>0 do
		begin
			q:=q*10;
			n1 :=n1 div 10;
		end;
	s:=(n div q)+1;
	writeln(s*q-n)
end;

begin
{	assign(input,'bai_1.inp');reset(input);
	assign(output,'bai_1.out');rewrite(output);}
		nhap;
		xuli;
end.

var     n,d,m,l,i,a,er:longint;
        st:string;
function kt(a:longint):boolean;
var i,d:integer;
    st:string;
begin
  str(a,st);
  i:=1; d:=0;
  for i:=1 to length(st) do if st[i]<>'0' then inc(d);
  if d>1 then kt:=false else kt:=true;
end;
begin
        readln(n);
        str(n,st); l:=length(st)-1; val(st[1],a,er); a:=a+1; str(a,st);
        for i:=1 to l do st:=st+'0';
        val(st,m,er);
        d:=m-n;

        writeln(d);
end.

var
 st,k,n,i:int64;
begin
 readln(n);
 //if n<=9 then begin writeln(10-n); exit; end;
 k:=0;
 i:=n;
 st:=1;
  while (i>0) do
   begin
    i:=i div 10;
    inc(k);
    st:=st*10;
   end;
 // writeln(st);
  st:=st div 10;
 // writeln(st);
  //writeln((n div st)+1);
 // writeln(((n div st)+1)*st);
 writeln(((n div (st))+1)*st-n);
end.

program z1;
var
  a, b, c, k, k1, i, b1, b2, v1, i3 : integer;

function v(var a1, i1 : integer):integer;
 var i2 : integer;
 begin
    for i2 := 1 to i1 - 1 do
      a1 := a1 * 10;
    v := a1;
  end;
begin
  read(k);
  a := k;
  while a <> 0 do
    begin
      b := b + (a mod 10);
      a := a div 10;
      inc(k1);
    end;
  a := k;
  for i := 1 to k1 - 1 do
    a := a div 10;
  c := a;
  b1 := 1;
  for i := 1 to k1 - 1 do
    b1 := b1 * 10;
  if b = c then writeln(b1)
    else begin
          a := k;
          for i := 1 to k1 - 1 do
            begin
              v1 := a mod 10;
              i3 := i;
              b2 := b2 + v(v1, i3);
              a := a div 10;
            end;
          writeln(b1 - b2);
         end;

end.

function kt(m:qword):boolean;
var cs,dem:qword;
Begin
        dem:=0;kt:=true;
        while m <> 0 do
         Begin
          cs:=m mod 10;
          if cs <> 0 then inc(dem);
          if dem > 1 then begin kt:=false;exit;end;
          m:=m div 10;
         End;
End;
var n,i,kq,a:qword;st:string;code:integer;
BEGIN
        read(n);
        if n < 10 then kq:=1;
        if n >=10 then if kt(n)=false then
        Begin
         i:=n+1;
         while i > 1 do
          Begin
          if kt(i)=true then
           Begin
            kq:=i-n;
            break;
           End;inc(i);
           end;
         End;
         if kt(n)=true then
         Begin
          str(n,st);
          st[1]:='1';
          val(st,a,code);
          kq:=n+a;
         End;
         write(kq);
END.

//const fi='number.inp';
//      fo='number.out';
var d,s,n,x:longint;
//procedure mo;
//begin
//        assign(input,fi);
//        reset(input);
//        assign(output,fo);
//        rewrite(output);
//end;

procedure nhap;
begin
        readln(n);
end;

procedure xuly;
begin
        x:=n;
        if n < 10 then
        begin
                write(1);
                exit;
        end;
        d:=1;
        s:=1;
        while x > 10 do
        begin
                x:=x div 10;
                s:=s*10;
                inc(d);
        end;
        write(s-(n-(x*s)));
end;

begin
      //  mo;
        nhap;
        xuly;
end.

var n,dem:longint;
begin
        read(n);
        if n<10 then write(1)
        else begin
        dem:=1;
        repeat
        n:=n div 10;
        dem:=dem*10;

        until n<10;
        write((n+1)*dem-n*dem);
        end;
end.

var n,c:int64;
a,b,i:int64;
begin
read(a);
n:=a;
b:=1;
while a>10 do
 begin
  a:=a div 10;
  b:=b*10;
 end;
b:=b*(a+1);
write(b-n);
end.

var
    n, k, tmp: longint;
begin
    readln(n);
    k:=n;
    while k <> 0 do
        begin
            tmp:=k mod 10;
            k:=k div 10;
        end;
    tmp:=tmp + 1;
    while tmp - n <= 0 do
        tmp:=tmp * 10;
    writeln(tmp);
end.

var
    n, k: longint;
    tmp: byte;
begin
    readln(n);
    k:=n;
    while n <> 0 do
        begin
            tmp:=n mod 10;
            n:=n div 10;
        end;
    tmp:=tmp + 1;
    while tmp <= k do
        tmp:=tmp * 10;
    writeln(tmp - k);
end.

var
    n, i: longint;
function check(k: longint): boolean;
 var
     free: array[1..9] of boolean;
     p: byte;
 begin
     fillchar(free, sizeof(free), false);
     while k <> 0 do
         begin
             if (free[k mod 10]) and (k mod 10 <> 0) then
                 begin
                     p:=p + 1;
                     if p = 2 then exit(false);
                 end;
             if (k mod 10 <> 0) then
                 free[k mod 10]:=true;
            k:=k div 10;
         end;
     exit(true);
 end;
begin
    readln(n);
    n:=n+1;
    i:=1;
    while check(n) = false do
        begin
            n:=n + 1;
            i:=i + 1;
        end;
    writeln(i);
end.

var
    n, i: longint;
function check(k: longint): boolean;
 var
     free: array[1..9] of boolean;
     p: byte;
 begin
     fillchar(free, sizeof(free), false);
     while k <> 0 do
         begin
             if (free[k mod 10]) and (k mod 10 <> 0) then
                 begin
                     p:=p + 1;
                     if p = 2 then exit(false);
                 end;
             if (k mod 10 <> 0) then
                 free[k mod 10]:=true;
            k:=k div 10;
         end;
     exit(true);
 end;
begin
    readln(n);
    i:=0;
    while check(n) = false do
        begin
            n:=n + 1;
            i:=i + 1;
        end;
    writeln(i);
end.

program Matfey;
var
x1,x2,x3,x4,x5,i,x6,x9,x8,x10,j,k,d,x7,x11,x12 : longint;
s1,s2,s3,s4,s5 : string;
c1,c2,c3,c4,c5 : char;
i1,i2 : integer;
r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,a,b : real;
a1,a2 : array[0..10000000] of longint;
begin
 {
assign(input,'input.txt'); reset(input);
assign(output,'output.txt'); rewrite(output);
}
readln(x1);

for i:=x1+1 to 100000000 do
begin
str(i,s1);
x3:=0;
for j:=1 to length(s1) do
if s1[j]<>'0' then x3:=x3+1;
if x3=1 then begin writeln(i-x1); exit; end;
end;

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

var     o,n,i,j:int32;
        k,s:string;
begin
        readln(n);
        str(n,s);
        begin
                if (length(s)=1) and (n<=5) then
                        begin
                                 write(5-n);
                                 readln;
                                 halt;
                        end
                else if (length(s)=1) and (n<=10) then
                        begin
                                write(10-n);
                                readln;
                                halt;
                        end;

                if s[1]='9' then
                        begin
                                s:=s+'0';
                                s[1]:='1';
                                val(s,o);
                                write(o-n);
                                readln;
                                halt;
                        end
                else
                k:=chr(ord(s[1])+1);
                for j:=2 to length(s) do k:=k+'0';
                val(k,o);
                write(o-n);
                readln;
                halt;
        end;
end.

var     o,n,i,j:int32;
        k,s:string;
        f:text;
begin
        assign(f,'');
        reset(f);
        readln(f,n);
        str(n,s);
        begin
                if (length(s)=1) and (n<=5) then
                        begin
                                 write(5-n);
                                 readln;
                                 halt;
                        end
                else if (length(s)=1) and (n<=10) then
                        begin
                                write(10-n);
                                readln;
                                halt;
                        end;

                if s[1]='9' then
                        begin
                                s:=s+'0';
                                s[1]:='1';
                                k:=s[1];
                                for i:=2 to length(s) do k:=k+'0';
                                val(k,o);
                                write(o-n);
                                readln;
                                halt;
                        end
                else
                k:=chr(ord(s[1])+1);
                for j:=2 to length(s) do k:=k+'0';
                val(k,o);
                write(o-n);
                readln;
                halt;
        end;
        close(f);
end.

var n,i,res:longint; s:string;
begin
    readln(s);
    for i:=1 to length(s) do n:=n*10+ord(s[i])-48;
    if n<5 then begin write(5-n); exit; end;
    res:=ord(s[1])-48+1;
    for i:=1 to length(s)-1 do res:=res*10;
    write(res-n);
end.

Program z1;
var n,a,b,c:longint;
begin
read(n);
a:=1;
b:=n;
while b>=10 do
begin
b:=b div 10;
a:=a*10;
end;
if n>10 then a:=a*(b+1)
        else a:=10;
a:=a-n;
write(a);
end.

Program z1;
var n,a,b,c:longint;
begin
read(n);
a:=1;
b:=n;
while b<>0 do
begin
c:=b mod 10;
b:=b div 10;
a:=a*10;
end;
a:=a div 10;
a:=a*(c+1);
a:=a-n;
write(a);
end.

   const eps=0.00000001;  besk1=200000008;  nn=200000;
   label 1,2;
    type   { real=double;}  {string=ansistring;}
    mas=array [0..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 i2,q,t,pos,x,y,z,pmax,imax,p1,p2,p3,p4,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1,besk:int64;
    newnapx,newnapy,napx,napy,p,time,pp,jj,step, k,ii,i,tt,j:longint;
     aa,bb,cc:double;
     aold,b,a:array[-10..2000000] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   prost,zanx,zany:array[-10..2000000] of boolean;
    sss, ss1,ss2:string;
     fl:array[0..200] of boolean;
    ss:string;ch:char;
    pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    function al(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;
     al:=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;

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

  read(p);
  t:=1;
  repeat t:=t*10 until t>p;
  t:=t div 10;
  q:=(p+1)  div t;
  write((q+1)*t-p);

   1:          close(output);
end.

var k,del,currentYear:integer;

begin
k:=1;
del:=1;
readln(currentYear);
if (currentYear>1) and (currentYear<10) then
 writeln(1)
else if currentYear>=10 then
  begin
    while k<>0 do
     begin
     del:=del*10;
      if (currentYear div del)<10 then
      begin
        k:=0;
     end;

  end;
  if ( ( ( (currentYear div del)+1) * del)-currentYear)<1000000000 then
    writeln( ( ( (currentYear div del)+1) * del)-currentYear)
  else
  writeln(1000000000);
 end;

end.

var k,del,currentYear:integer;

begin
k:=1;
del:=1;
readln(currentYear);
if (currentYear>1) and (currentYear<10) then
 writeln(1)
else if currentYear>10 then
  begin
    while k<>0 do
     begin
     del:=del*10;
      if (currentYear div del)<10 then
      begin
        k:=0;
     end;

  end;
  writeln( ( ( (currentYear div del)+1) * del)-currentYear);
 end;

end.

var k,del,currentYear:integer;

begin
k:=1;
del:=10;
readln(currentYear);
if (currentYear>1) and (currentYear<10) then
 writeln(1)
else if currentYear>10 then
  begin
    while k<>0 do
     begin
     del:=del*10;
      if (currentYear div del)<10 then
      begin
        k:=0;
     end;

  end;
  writeln( ( ( (currentYear div del)+1) * del)-currentYear);
 end;

end.

var
  a,b,c,d,n,i:longint;
 begin
   readln(n);
    a:=0;
    b:=1;
    c:=n;
    d:=0;
   while n<>0 do
    begin
     n:=n div 10;
     a:=a+1;
     b:=b*10;
    end;
    b:=b div 10;
   for i:=1 to b do
    begin
     c:=c+1;
     d:=d+1;
     if (c mod b=0)  then begin writeln(d); halt; end; end;
 end.

var
  a,b,c,d,n,i:integer;
 begin
   readln(n);
    a:=0;
    b:=1;
    c:=n;
    d:=0;
   while n<>0 do
    begin
     n:=n div 10;
     a:=a+1;
     b:=b*10;
    end;
    b:=b div 10;
   for i:=1 to b do
    begin
     c:=c+1;
     d:=d+1;
     if (c mod b=0) then begin writeln(d); halt; end; end;
 end.

var n,m,k: longint;
BEGIN
  readln(n);
  k:=1; m:=n;
  while m > 0 do
    begin
      k:=k*10;
      m:=m div 10;
    end;
  k:=k div 10;  m:=k;
  while k <= n do inc(k,m);
  write(k - n);
END.

program lucky_year;
var
        i, n, x,a,year,j: integer;
begin
        write('nhap so nam: ');
        readln(n);
        x:=n;
        i:=0;
        a:=1;
        while n>=1 do
        begin
                n:= trunc(n div 10);
                i:=i+1;
        end;
        writeln('n la so co: ',i,' chu so');
        for j:=1 to i-1 do
                a:=a*10;
        n:=x;
        n:=trunc(n div a);
        year:=(n+1)*a;
        writeln('Lucky year la: ',year);
        writeln('Output: ',year-x);
        readln;
end.

var n,j:integer;
  j1,k,j2:real;
begin
 k:=0;
read(n);
if n<10 then k:=n+1-n;
if n>=10 then begin j2:=100;j1:=100; while j<>1 do
   begin
   if n<j2 then
   begin
   k:=j2-n;
   j:=1;
   end
   else j2:=j2+j1;
   if j2>=j1*10 then j1:=j1*10;
   end;
   end;
   write(k);
   end.

var n,j:integer;
  j1,k,i,j2:integer;
begin
  k:=0;
  read(n);
  if n < 10 then
  begin
    i := 2;
    while j <> 1 do
    begin
      if n < i then
      begin
        k := i-n;
        j := 1;
      end else
        i := i+1;
    end;
  end;
  if n >= 10 then
  begin
    j2 := 100;
    j1 := 100;
    while j <> 1 do
    begin
      if n < j2 then
      begin
        k := j2-n;
        j := 1;
      end else
        j2 := j2+j1;
      if j2 >= j1*10 then
        j1:=j1*10;
    end;
  end;
  write(k);
end.

var n,j:integer;
  j1,k,i,j2:real;
begin
 k:=0;
read(n);
if n<10 then begin i:=2; while j<>1 do begin if n<i then begin k:=i-n; j:=1; end else i:=i+1;end; end;
if n>=10 then begin j2:=100;j1:=100; while j<>1 do
   begin
   if n<j2 then
   begin
   k:=j2-n;
   j:=1;
   end
   else j2:=j2+j1;
   if j2>=j1*10 then j1:=j1*10;
   end;
   end;
   write(k);
   end.

var n,j:integer;
  j1,k,i,j2:real;
begin
 k:=0;
write('n=');read(n);
if n<10 then begin i:=2; while j<>1 do begin if n<i then begin k:=i-n; j:=1; end else i:=i+1;end; end;
if n>=10 then begin j2:=100;j1:=100; while j<>1 do
   begin
   if n<j2 then
   begin
   k:=j2-n;
   j:=1;
   end
   else j2:=j2+j1;
   if j2>=j1*10 then j1:=j1*10;
   end;
   end;
   write(k);
   end.

var n,j:integer;
  j1,k,j2:real;
begin
read(n);
if n<10 then write('1')
 else k:=0;j2:=100;j1:=100; while j<>1 do
   begin
   if n<j2 then
   begin
   k:=j2-n;
   j:=1;
   end
   else j2:=j2+j1;
   if j2>=j1*10 then j1:=j1*10;
   end;
   write(k);
   end.

const tfi = '';
tfo = '';
var m,n,cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi, m,n);
end;
procedure xuly;
begin
read(fi,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur +t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure xuly;
begin
read(fi,p,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var m,n,cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi, m,n);
end;
procedure xuly;
begin
read(fi,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var m,n,cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi, m,n);
end;
procedure xuly;
begin
read(fi,p,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var m,n,cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi, m,n);
end;
procedure xuly;
begin
read(fi,p,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur +t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure xuly;
begin
read(fi,p,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	p:= (y+1) * cur -t;
	end;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var m,n,cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure init;
begin
read(fi, m,n);
end;
procedure xuly;
begin
read(fi,y);
t:=y;
cur:=1;
if y>9 then
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -y;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
init;
xuly;
xuat;
closef;
end.

const tfi = '';
tfo = '';
var cur,y,t,p: integer;
fi,fo: text;
procedure nhapdl;
begin
assign(fi, tfi);reset(fi);
assign(fo, tfo); rewrite(fo);
end;
procedure closef;
begin
close(fi);
close(fo);
end;
procedure xuly;
begin
read(fi,p,y);
t:=y;
cur:=1;
while y>9 do
	begin
	y:=y div 10;
	cur:=cur*10;
	end;
	p:= (y+1) * cur -t;
end;
procedure xuat;
begin
write(fo, p);
end;
begin
nhapdl;
xuly;
xuat;
closef;
end.

var a,q:LongInt;
    s:string;
begin
readln(a);
str(a,s);
q:=trunc(exp(ln(10)*(length(s)-1)))-(a mod trunc(exp(ln(10)*(length(s)-1))));
writeln(q);
end.

var a,q:LongInt;
    s:string;
begin
readln(a);
str(a,s);
q:=trunc(exp(ln(10)*(length(s)-1)));
writeln(q);
end.

program sd;
var s:string;
b,x,k,bn,n,i:integer;
begin
read(s);
val(s,b,x);
k:=length(s);
n:=1;
for i:= 2 to k do
n:= n * 10;
bn:=b mod n mod 10 ;
write(n-bn);
end.

var a:string;
k,p,c,i:longint;
begin
read(a);
c:=1;
if length(a)=1 then write(1) else begin
for i:=1 to length(a) do begin
k:=k*p+ord(a[i])-48;
p:=10;
c:=c*10;
end;
write((ord(a[1])-48+1)*c div 10-k);
end;
end.

var a:string;
k,p,c,i:integer;
begin
read(a);
c:=1;
if length(a)=1 then write(1) else begin
for i:=1 to length(a) do begin
k:=k*p+ord(a[i])-48;
p:=10;
c:=c*10;
end;
write((ord(a[1])-48+1)*c div 10-k);
end;
end.

var     n,d,m,l,i:longint;
        st:string;
function kt(a:longint):boolean;
var i,d:integer;
    st:string;
begin
  str(a,st);
  i:=1; d:=0;
  for i:=1 to length(st) do if st[i]<>'0' then inc(d);
  if d>1 then kt:=false else kt:=true;
end;
begin
        readln(n);
        str(n,st); l:=length(st)-1; st:=chr(ord(st[1])+1);
        for i:=1 to l do st:=st+'0';
        val(st,m);
        d:=m-n;

        writeln(d);
end.

var
 st,k,n,i:longint;
begin
 readln(n);
 k:=0;
 i:=n;
 st:=1;
  while (i>0) do
   begin
    i:=i div 10;
    inc(k);
    st:=st*10;
   end;
 // writeln(st);
  st:=st div 10;
//  writeln(st);
 writeln(((n div (st))+1)*st-n);
end.

var
 st,k,n,i:longint;
begin
 readln(n);
 if n<=9 then begin writeln(10-n); exit; end;
 k:=0;
 i:=n;
 st:=1;
  while (i>0) do
   begin
    i:=i div 10;
    inc(k);
    st:=st*10;
   end;
 // writeln(st);
  st:=st div 10;
//  writeln(st);
 writeln(((n div (st))+1)*st-n);
end.