Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345 are not.You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year.

The first line contains integer number n (1 ≤ n ≤ 109) — current year in Berland.

Output amount of years from the current year to the next lucky one.

NoteIn the first example next lucky year is 5. In the second one — 300. In the third — 5000.

import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if (n <= 9) {
            System.out.println(1);
            return;
        }
        int len = dig(n);
        int a =  n  / power(10, len - 1);
        a++;
        System.out.println(a * power(10, len - 1) - n);
    }

     public static int power(int a, int b) {
        int res = 1;
        while (b > 0) {
            if (b % 2 != 0) {
                res = mul(a, res);
            }
            b >>= 1;
            a = mul(a, a);
        }
        return res;
    }

    public static int mul(int a, int b) {
        return a * b;
    }

    public static int dig(int n) {
        int res = 0;
        while (n > 0) {
            n /= 10;
            res++;
        }
        return res;
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		int n = input.nextInt();
		if (n < 10)
		{
			System.out.println(1);
		} else if (n < 100)
		{
			System.out.println(10 - (n % 10));
		} else if (n < 1000)
		{
			System.out.println(100 - (n % 100));
		} else if (n < 10000)
		{
			System.out.println(1000 - (n % 1000));
		} else if (n < 100000)
		{
			System.out.println(10000 - (n % 10000));
		} else if (n < 1000000)
		{
			System.out.println(100000 - (n % 100000));
		} else if (n < 10000000)
		{
			System.out.println(1000000 - (n % 1000000));
		} else if (n < 100000000)
		{
			System.out.println(10000000 - (n % 10000000));
		} else if (n < 1000000000)
		{
			System.out.println(100000000 - (n % 100000000));
		} else
		{
			System.out.println(1000000000);
		}
	}
}

import java.util.*;

    public class Main {

        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            if(n<=9){
                System.out.println(1);
            }else {
                String copy = String.valueOf(n);
                double amount = Math.pow(10,copy.length()-1);
                int first = Integer.parseInt(copy.substring(0,1));
                double ans = Math.abs((first*amount+amount))-n;
                System.out.println((int)ans);

            }

        }

    }

import java.io.*;
import java.util.*;

public class TestClass {

    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) throws Exception{
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(in.readLine());
        String s = Integer.toString(t);
        int x = s.charAt(0)-'0';
        StringBuilder k = new StringBuilder();
        x++;
        k.append(x);
    	for(int i=0;i<s.length()-1;i++)
    	{
    		k.append(0);
    	}
        int l = Integer.parseInt(k.toString());
        out.println(l-t);
        out.close();
    }
}

import java.util.*;

public class Year
{
    public static void main(String[] args)
    {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int odp=0;
		if(n<10) odp=1;
		else
		{
			int u=10;
			while(n>u) u*=10;
			if(n!=u) u=u/10;
			odp=u-(n%u);
		}

		System.out.println(odp);
	}
}

import java.util.Scanner;
public class main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String year,str="";
        int year1,year2,len;
        year = input.nextLine();
        len = year.length();
        int i,result=0;
        if(len>2)
        {
            for(i=1;i<len;i++)str+=year.charAt(i);
            year1 = Integer.parseInt(str);
            year2 = Integer.parseInt(year);
            if(year2<100&&year2>=10)result = 100-year2;
            else if(len==3)result=100-year1;
            else if(len==4)result=1000-year1;
            else if(len==5)result=10000-year1;
            else if(len==6)result=100000-year1;
            else if(len==7)result=1000000-year1;
            else if(len==8)result=10000000-year1;
            else if(len==9)result=100000000-year1;
            else if (len==10)result=1000000000-year1;
            System.out.println(result);
        }
        else if (len==2)
        {
            year2 = Integer.parseInt(year);
            if(year2>=10&&year2<20)System.out.println(20-year2);
            else if(year2>=20&&year2<30)System.out.println(30-year2);
            else if(year2>=30&&year2<40)System.out.println(40-year2);
            else if(year2>=40&&year2<50)System.out.println(50-year2);
            else if(year2>=50&&year2<60)System.out.println(60-year2);
            else if(year2>=60&&year2<70)System.out.println(70-year2);
            else if(year2>=70&&year2<80)System.out.println(80-year2);
            else if(year2>=80&&year2<90)System.out.println(90-year2);
            else if(year2>=90&&year2<100)System.out.println(100-year2);
        }
        else {
            year1 = Integer.parseInt(year);
            System.out.println("1");
        }

    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.*;

/**
 *
 * @author Deibu
 */
public class Luckyear {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int input = in.nextInt();
        String str = "" + input;
        String op = "";
        if (input<1||input>1000000000) {
            System.exit(0);
        }
        char c1 = 0;
        char c = 0;
        int g = 0;
        c1 = str.charAt(0);
        if (c1 != '9') {
            g = (int) c1;
            g += 1;
            op += (char) g;
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        } else {
            op += "10";
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        }

        int s;
        s = Integer.valueOf(op);
        System.out.println( s - input);

    }

}

import java.util.*;
import java.io.*;

public class A {
	public static void main(String[] args){
		Scanner s  = new Scanner(System.in);
		int year = s.nextInt();
		int start = year;
		int digits = Integer.toString(year).length() - 1;
		System.out.println((int)((year/((int)Math.pow(10, digits)))+1) * (int)Math.pow(10, digits) - start);

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class CF808A {

    public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		//OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(System.out);
                int n=in.nextInt();
                String s=n+"";
                int c=0;
                int l=s.length();
                for(int i =1;i<l;i++){
                    if(s.charAt(i)=='0')
                        c++;
                    else break;
                }
                double ans=0;
                if(c==l-1)
                {
                    ans=Math.pow(10, l-1);
                }
                else
                {
                    ans=((s.charAt(0)-'0')+1)*Math.pow(10, l-1)-n;
                }
                out.println((int)ans);
		out.close();

    }
    static class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream inputstream) {
		reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}

	public String nextLine(){
		String fullLine=null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				fullLine=reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return fullLine;
		}
		return fullLine;
	}
	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){

        Scanner sc=new Scanner(System.in);
        String year=sc.next();
        int numYear=Integer.parseInt(year);
        if(numYear < 0) {
            System.out.println("Not valid Year!!!");
            return;
        }
        char[] yearArray=year.toCharArray();
        int nextLuckyYear = Integer.parseInt(""+yearArray[0]);
        nextLuckyYear++;
            while (nextLuckyYear < numYear) {
                nextLuckyYear = nextLuckyYear * 10;
            }
            System.out.println(nextLuckyYear - numYear);
    }

}

import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		if(a<10)
			System.out.print("1");
		else{
		int t = a;
		int c = -1;
		while(a>0){
			c++;
			a/=10;
		}
		int t1 = ((int)t/(int)Math.pow(10, c))+1;
		int t2 = (t1*(int)Math.pow(10, c)-t);
		System.out.print(""+t2);
		}
	}
}

import java.util.*;
public class a
{
    public static void main(String []args)
    {
        Scanner sc=new Scanner(System.in);
        String a=sc.next();
        int c=Integer.parseInt(a.charAt(0)+"");
        c++;
        int l=a.length();
        l--;
        int n=c*(int)Math.pow(10,l);
        System.out.println(n-Integer.parseInt(a));
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            if (n <= 9) {
                System.out.print(1);
                return;
            }
            int len = dig(n);
            int a = n / power(10, len - 1);
            a++;
            System.out.print(a * power(10, len - 1) - n);
        }

        public static int power(int a, int b) {
            int res = 1;
            while (b > 0) {
                if (b % 2 != 0) {
                    res = mul(a, res);
                }
                b >>= 1;
                a = mul(a, a);
            }
            return res;
        }

        public static int mul(int a, int b) {
            return a * b;
        }

        public static int dig(int n) {
            int res = 0;
            while (n > 0) {
                n /= 10;
                res++;
            }
            return res;
        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class main {
	static int n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (Integer.parseInt(line)<=9) {
			System.out.println("1");
		} else {
			int p = 1;
			for (int i = 0; i < line.length()-1; i++) {
				p = p * 10;
			}
			int result = p *( Character.getNumericValue(line.charAt(0))+1);
			System.out.println(result - Integer.parseInt(line));
		}
	}
}

import java.util.*;

public class demo {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.next();
        long value = Long.valueOf(str);
        if(value < 10){
            System.out.println(1);return;
        }
        String string = "1";
        for(int i = 1 ; i < str.length() ; i++){
            string += "0";
        }
        int num = Integer.parseInt(string);
        while (true){
            if(value - num < 0){
                System.out.println(Math.abs(value - num));
                return;
            }
            else{
                num += Integer.parseInt(string);
            }
        }
    }
}

import java.util.Scanner;
public class LuckyYear {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		int n = input.nextInt();
		int counter = 1;

		String num = String.valueOf(n);

		if(num.length() == 1){
			System.out.println(counter);
			return;
		}

		String subNum = num.substring(1);
		String mainNum = "1";

		for(int i = 1; i < num.length() ; i++)
			mainNum += '0';

		System.out.println(Integer.parseInt(mainNum) - Integer.parseInt(subNum));

	}

}

import java.util.Scanner;

public class lucky {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextInt();
		long m=n;
		long i=0;
		long j=0;
		long h=m*10;
		while(m!=0){

			j++;
			m/=10;
			h/=10;

		}
		if(j==1){
			i=1;
		}else{
			i=(long)((h+1)*Math.pow(10, j-1))-n;
		}

/*
		while(true){
			long j=0;
			long m=n;
			while(m!=0){
				if(m%10!=0){
					j++;
				}m/=10;
			}
			if(j==1){
				break;
			}
			n++;
			i++;

		}*/
		System.out.println(i);

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static String replaceCharAt(String str1, int pos, char c) {
        StringBuffer buf = new StringBuffer(str1);
        buf.setCharAt(pos, c);
        return buf.toString();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String chaine = scanner.nextLine();
        Long number = Long.parseLong(chaine), w = number;
        int mult = 1;
        while (w / 10 != 0) {
            mult *= 10;
            w /= 10;
        }
        String ch = String.valueOf(mult);
        char suiv;
        if (chaine.charAt(0) == '9') {
            suiv = '1';
            ch = ch + "" + "0";
        } else {
            suiv = (char) ((int) chaine.charAt(0) + 1);
        }

        ch = replaceCharAt(ch, 0, suiv);
        System.out.println(Long.parseLong(ch) - Long.parseLong(chaine));

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ALuckyYear solver = new ALuckyYear();
        solver.solve(1, in, out);
        out.close();
    }

    static class ALuckyYear {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            long n = in.scanInt();
            out.println(next(n) - n);
        }

        long next(long k) {
            char[] ar = Long.toString(k).toCharArray();
            if (ar[0] != '9') {
                ar[0]++;
                for (int i = 1; i < ar.length; i++) ar[i] = '0';
                return Long.parseLong(String.valueOf(ar));
            } else {
                for (int i = 0; i < ar.length; i++) ar[i] = '9';
                return Long.parseLong(String.valueOf(ar)) + 1;
            }

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.ArrayList;
	import java.util.Arrays;
	import java.util.Map.Entry;
	import java.util.PriorityQueue;
	import java.util.StringTokenizer;
	import java.util.*;

	   public class Solution {

		/*public static int ispr(int n)
	    	{
	    	//boolean[] isPrime = new boolean[n+1];
	        for (int i = 2; i <= n; i++) {
	            Prime[i] = true;
	        }

	        // mark non-primes <= n using Sieve of Eratosthenes
	        for (int factor = 2; factor*factor <= n; factor++) {

	            // if factor is prime, then mark multiples of factor as nonprime
	            // suffices to consider mutiples factor, factor+1, ...,  n/factor
	            if (Prime[factor]) {
	                for (int j = factor; factor*j <= n; j++) {
	                    Prime[factor*j] = false;
	                }
	            }
	        }
	        // count primes

	        /*int primes = 0;
	        for (int i = 2; i <= n; i++) {
	            if (isPrime	[i])System.out.println(i);

	        }*/
		// System.out.println("The number of primes <= " + n + " is " + primes);
		//return 0;
		// if(isPrime[n]==true)return 1; else return 0;

		//}

		public static long fact(long x)
		{
			if(x==0)return 1;
			else return x*fact(x-1);
		}

		public static long exp(long x, long n, long M)
		{

			if(n==0) return 1;

			else if(n%2==0) return exp((x*x)%M,n/2,M);
			else return (x*exp((x*x)%M,(n-1)/2,M))%M;

		}

		//fi

		static long fib(long n)
		{
			long F[][] = new long[][]{{1,1},{1,0}};
			if (n == 0)
				return 0;
			power(F, n-1);

			return F[0][0];
		}

		static int mod=1000000007;

		static void multiply(long F[][], long M[][])
		{
			long x =  (((F[0][0]%mod)*(M[0][0]%mod))%mod + ((F[0][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long y =  (((F[0][0]%mod)*(M[0][1]%mod))%mod + ((F[0][1]%mod)*(M[1][1]%mod))%mod)%mod;
			long z =  (((F[1][0]%mod)*(M[0][0]%mod))%mod + ((F[1][1]%mod)*(M[1][0]%mod))%mod)%mod;
			long w =  (((F[1][0]%mod)*(M[0][1]%mod))%mod + ((F[1][1]%mod)*(M[1][1]%mod))%mod)%mod;

			F[0][0] = x;
			F[0][1] = y;
			F[1][0] = z;
			F[1][1] = w;
		}

		/* Optimized version of power() in method 4 */
		static void power(long F[][], long n)
		{
			if( n == 0 || n == 1)
				return;
			long M[][] = new long[][]{{1,1},{1,0}};

			power(F, n/2);
			multiply(F, F);

			if (n%2 != 0)
				multiply(F, M);
		}

		public static int gcd(int a, int b)
		{
			if(b==0)
				return a;
			else return gcd(b,a%b);
		}

		static  class MyScanner {

			BufferedReader br;
			StringTokenizer st;

			public MyScanner() {
				br = new BufferedReader(new InputStreamReader(System.in));
			}

			String next() {
				while (st == null || !st.hasMoreElements()) {
					try {
						st = new StringTokenizer(br.readLine());
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}

			int nextInt() {
				return Integer.parseInt(next());
			}

			long nextLong() {
				return Long.parseLong(next());
			}

			double nextDouble() {
				return Double.parseDouble(next());
			}

			String nextLine(){
				String str = "";
				try {
					str = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				return str;
			}

		}

		static MyScanner sc = new  MyScanner();
		static PrintWriter pw = new PrintWriter(System.out, true);

		static void printPath(int parent[], int j)
		{
		    // Base Case : If j is source
		    if (parent[j]==-1)
		        {pw.print(j+" ");return;}

		    printPath(parent, parent[j]);

		    pw.print(j+" ");
		}

		//Main begins here :)

		public static class Pair{
		    int a;
		    int b;
		    Pair(int p,int q){
		        a=p;
		        b=q;
		    }
		    public boolean equals(Object o) {
		        if (o instanceof Pair) {
		            Pair p = (Pair)o;
		            return p.a == a && p.b == b;
		        }
		        return false;
		    }
		    public int hashCode() {
		        return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		    }
		}

		public static int max1(String st, int k)
		{
			int n1=0;
			int max=Integer.MIN_VALUE;
			int n = st.length();
			if(n==1)
			{
				if(st.charAt(0)=='1')return 1;
				else return 0;
			}

			for(int i=1;i<=k;i++)
			{
				int chp=i-1;

				if(st.charAt(chp)=='1')n1++;

			}
			max=Math.max(max, n1);
		//	if(k>=n)return max;
			int slides=n-k;
			int ptr1=0, ptr2=k-1;

			for(int i=1;i<=slides;i++)
			{
				//pw.println(st.substring(ptr1+i, ptr2+i+1));
				ptr1++; ptr2++;
				if(st.charAt(ptr1-1)=='1')n1--;
				if(st.charAt(ptr2)=='1')n1++;
				//pw.println("m1- "+n1);
				if(n1>max)max=n1;
				if(max==k){return k;}
			}

			return max;

		}

		public static String shift(String A)
		{
			char lc = A.charAt(A.length()-1);
			return lc+A.substring(0,A.length()-1);

		}

		static  class Point
		{
			long x,y;

			public Point(long a, long b)
			{
				x=a;
				y=b;
			}

			public int compareTo(Point o) {
				// TODO Auto-generated method stub
				return Long.compare(this.x, o.x);

			}

		}

		static class compx implements Comparator<Point>
		{
			public int compare(Point a, Point b)
			{

				if(a.x>b.x)return 1;
				if(a.x<b.x) return -1;

				return 0;
			}
		}

		public static int lucky(long y)
		{

			long d = y;
			int flg=0;
			//long nd = (long)Math.floor(Math.log10((double)y));
			//pw.println(nd);
			for(;d>=1;d=d/10)
			{
				long dg = d%10;
				if(dg!=0)flg++;
				if(flg==2)return 0;

			}
			return 1;

		}

		public static void main(String[] args) {

			//pw.println(max1("11",2));
			/*String nm = "10011";
			for(int i=0;i<6;i++)
			{
				nm = shift(nm);
				pw.println(nm);
				pw.println(max1(nm,3));
				pw.println("****");
			}*/

			/*Point arr[] = new Point[4];
			for(int i=0;i<4;i++)
			{
				int a = sc.nextInt();
				int b = sc.nextInt();
				Point p = new Point(a,b);
				arr[i]=p;
			}
			Arrays.sort(arr, new compx());*/
			//for(int i=0;i<4;i++)pw.println(arr[i].x+" "+arr[i].y);

		int n  =sc.nextInt();

		long nd = (long)Math.floor(Math.log10((double)n));
		//pw.println(nd);
		long td = n/(long)Math.pow(10, nd);
		//pw.println(td);
		td++;
		long tl  = ((int)Math.pow(10, nd))*td;

		pw.println((tl-n));

		//lucky(n);
		/*long ans=0;
		long cn=0;
		for(long i=1;lucky(cn)!=1;i++)
		{
			cn = n+i;
			if(lucky(cn)==1)
			{
				ans=i;
				break;
			}
		}
			*/

	pw.close();
		}

	}

import java.io.*;

public class Lucky2 {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    long y = Long.parseLong(in.readLine());
    long pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      long h = 1;
      long l = 0;
      long t = 0;
      while(h * 10 <= y){
        long u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
        long g = y;
        boolean ppp = true;
        while(g > 10){
          if(g % 10 != 0){
            ppp = false;
          }
          g = g / 10;
        }
        if(ppp){ break; }
      }

    System.out.println(y-pp);
  }}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author rizhiy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            if (n < 10) {
                out.println(1);
                return;
            }
            int nn = n;
            int y = 1;
            while (nn >= 10) {
                y *= 10;
                nn = nn / 10;
            }
            for (int i = 1; i <= 10; i++) {
                if (y * i > n) {
                    out.println(y * i - n);
                    return;
                }
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class LuckyYear
{

    public static void main(String[] args)
    {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        long x = sc.nextLong();
        String s = x+"";
        int length = s.length();

        if( length == 1 )
        {
            out.print(1);
            out.close();
        }
        else
        {
            long a = (long)Math.pow(10, length);
            long b = a / 10 ;
            out.print( b - x%b  );
            out.close();
        }
    }

}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        try	{
            br = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer("");
        } catch (Exception e){e.printStackTrace();}
    }

    public String next() {
        if (st.hasMoreTokens())	return st.nextToken();
        try {st = new StringTokenizer(br.readLine());}
        catch (Exception e) {e.printStackTrace();}
        return st.nextToken();
    }

    public int nextInt() {return Integer.parseInt(next());}

    public long nextLong() {return Long.parseLong(next());}

    public double nextDouble() {return Double.parseDouble(next());}

    public String nextLine() {
        String line = "";
        try {line = br.readLine();}
        catch (Exception e) {e.printStackTrace();}
        return line;
    }

    public Integer[] nextIntegerArray(int n) {
        Integer[] a = new Integer[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public char[] nextCharArray() {
        return nextLine().toCharArray();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int input = 0, output = 0, firstNumb = 0, length = 0;
        try {
            String line = br.readLine();
            length = line.length();
            firstNumb = Integer.parseInt(Character.toString(line.charAt(0)));
            input = Integer.parseInt(line);
        } catch (IOException e) {
            e.printStackTrace();
        }

        if (firstNumb == input) {
            output = 1;
        }
        else {
            ++ firstNumb;
            for (int i = 0 ; i < length - 1 ; i++) {
                firstNumb = firstNumb * 10;
            }

            output = firstNumb - input;
        }

        System.out.println(output);
    }
}

import java.util.*;
public class CFED1 {
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      long current = sc.nextLong();
      if(current < 10){
         System.out.println(1);
      }else{
         long next = current;
		 long power = 1;
		 while(next >= 10){
			 next = next/10;
			 power = power * 10;
		 }
         System.out.println((next + 1) * power - current);
      }
   }
}

import java.util.Scanner;

public class LuckyYear
{
    public static void main(String [] args)
    {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();

        if(n < 10)
            System.out.println(1);
        else
        {
            StringBuilder str = new StringBuilder();
            str.append(n);

            int firstDigit = Character.getNumericValue(str.charAt(0)) + 1;

            if(firstDigit == 10)
                str.setCharAt(0, '1');
            else
                str.setCharAt(0, (char) (firstDigit + '0'));

            for(int i = 1; i < str.length(); i++)
                str.setCharAt(i, '0');

            if(firstDigit == 10)
                str.append(0);

            System.out.println(Math.abs(Long.parseLong(str.toString())) - n);
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;

public class JavaApplication14 {

static int n;
static int ans;

    public static int happy(int i)
    {
        if(i<10) return 0;
        if(i%10==0) return happy(i/10)*10;
        else
        {
          return happy((i+(10-(i%10)))/10)*10+10-i%10;
        }

   }

    public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw = new PrintWriter(System.out);
    StringTokenizer st = new StringTokenizer(br.readLine());
    n = Integer.parseInt(st.nextToken());

    ans = happy(n+1)+1;
    pw.print(ans);
    pw.close();
    }

}

import java.lang.String;
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
                     int year;
                    year = input.nextInt();
                    int add = 0;
                    String buffer = Integer.toString(year);
                    if(buffer.length() == 1)
                    {
                        add = 1;
                    }
                    else if(buffer.length() != 1)
                    {
                        double first_num = year / (Math.pow(10,(buffer.length()-1)));
                        double next_lucky = ( (int)first_num + 1 ) * Math.pow ( 10 ,(buffer.length()-1));
                        add = (int)next_lucky - year;
                    }

                    System.out.println(add);

    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author o_panda_o(emailofpanda@yahoo.com)
 */
public class Code_808A_LuckyYear{
    public static void main(String[] args){
        InputStream inputStream=System.in;
        OutputStream outputStream=System.out;
        InputReader in=new InputReader(inputStream);
        OutputWriter out=new OutputWriter(outputStream);
        _808A_ solver=new _808A_();
        solver.solve(1,in,out);
        out.close();
    }

    static class _808A_{
        public void solve(int testNumber,InputReader in,OutputWriter out){
            long n=in.nextLong(), min=Integer.MAX_VALUE;
            for(long i=1;i<=9;++i)
                for(long j=1;j<=1_00_00_00_000;j*=10)
                    if(i*j>n) min=Math.min(min,i*j-n);
            out.print(min);
        }

    }

    static class OutputWriter{
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream){
            writer=new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer){
            this.writer=new PrintWriter(writer);
        }

        public void close(){
            writer.close();
        }

        public void print(long i){
            writer.print(i);
        }

    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf=new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream){
            this.stream=stream;
        }

        public int read(){
            if(numChars==-1){
                throw new InputMismatchException();
            }
            if(curChar>=numChars){
                curChar=0;
                try{
                    numChars=stream.read(buf);
                }catch(IOException e){
                    throw new InputMismatchException();
                }
                if(numChars<=0){
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong(){
            int c=read();
            while(isSpaceChar(c)){
                c=read();
            }
            int sgn=1;
            if(c=='-'){
                sgn=-1;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9'){
                    throw new InputMismatchException();
                }
                res*=10;
                res+=c-'0';
                c=read();
            }while(!isSpaceChar(c));
            return res*sgn;
        }

        public boolean isSpaceChar(int c){
            if(filter!=null){
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }

        public interface SpaceCharFilter{
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.*;
import java.io.*;
public class lucky_year{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String n = sc.nextLine();
      if(n.length() == 1){
         System.out.println(1);
      }
      else{
         System.out.println((int)((Integer.parseInt(n.substring(0,1))+1)*Math.pow(10, n.length()-1)-Integer.parseInt(n)));
      }
   }
}

 import java.util.*;
public class Main{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int T = (int) Math.floor(Math.log10(N));
        int P = (int) Math.pow(10, T);
        int C = P - (N % P);
        C = (C == 0) ? P : C;
        System.out.print(C);

    }
}

import java.io.*;
import java.util.StringTokenizer;

public class ProblemA {

    public static void solve(InputReader in, PrintWriter out) throws IOException{
        int n = in.nextInt();
        if (n < 10){
            out.println(1);
            return;
        }

        for (int i=2; i<100; i++){
            if (n < Math.pow(10, i)){
                int year = (int) (Math.pow(10, i-1)*(n/(int)(Math.pow(10, i-1))+1));
                if (year > n) {
                    out.println(year-n);
                    return;
                }
            }
        }
    }

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));

            int sampleNumber = 1;
            do {
                out.println("Sample #" + sampleNumber++ + ": ");
                solve(in, out);
                out.println("");
            } while (in.reader.readLine() != null);
        } else {
            in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            solve(in, out);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException{
            return Integer.parseInt(next());
        }
    }

}

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Pattern;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
      //  System.out.println(10%9);
        int buff= n;
        int count =0;
        while(buff>=10){
            buff/=10;
            count++;
            System.out.println();
        }
        buff+=1;
        while (count!=0){
            buff*=10;
            count--;
        }
        System.out.println(buff-n);

    }
}

import java.io.*;
import java.util.StringTokenizer;

public final class Solution implements Closeable, AutoCloseable
{
  void Solve() throws NumberFormatException, IOException
  {
    int n = input.nextInt();
    int k = n;
    int c = 0;
    while (n >= 10)
    {
      n /= 10;
      c++;
    }
    int m = n + 1;
    for (int i = 0; i < c; i++)
      m *= 10;
    output.print(m - k);
  }

  private final FastScanner input;
  private final PrintWriter output;

  Solution()
  {
    input = new FastScanner(System.in);
    output = new PrintWriter(System.out);
  }

  public static void main(String[] args) throws IOException
  {
    try (Solution solution = new Solution())
    {
      solution.Solve();
    }
  }

  @Override
  public void close()
  {
    output.flush();
    output.close();
  }

  @SuppressWarnings("unused")
  class FastScanner
  {
    private static final int bufferSize = 64 * 1024;
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    FastScanner(InputStream inputStream)
    {
      this.reader = new BufferedReader(new InputStreamReader(inputStream), bufferSize);
    }

    String nextToken() throws IOException
    {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
      {
        String line = reader.readLine();
        if (line == null)
        {
          tokenizer = null;
          return null;
        }
        tokenizer = new StringTokenizer(line);
      }
      return tokenizer.nextToken();
    }

    int[] readIntArray(int n) throws IOException
    {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
      {
        a[i] = nextInt();
      }
      return a;
    }

    long[] readLongArray(int n) throws IOException
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
      {
        a[i] = nextLong();
      }
      return a;
    }

    int nextInt() throws NumberFormatException, IOException
    {
      return Integer.parseInt(nextToken());
    }

    long nextLong() throws NumberFormatException, IOException
    {
      return Long.parseLong(nextToken());
    }

    double nextDouble() throws NumberFormatException, IOException
    {
      return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException
    {
      tokenizer = null;
      return reader.readLine();
    }
  }
}

import java.util.Scanner;

public class LuckyYear {
	public static void main(String[] args) throws Exception {

		int in = (new Scanner(System.in)).nextInt();

		if (in < 10) {
			System.out.println(1);
		} else if (Math.log10(in) == (int)Math.log10(in)) {
			System.out.println(in);

		} else {
			double nx = in;
			int count = 0;
			while (nx > 10) {
				nx = nx / 10;
				count++;
			}
			int next = ((int)nx + 1) * (int)Math.pow(10, count);
			//System.out.println(next);
			System.out.println(next - in);
		}

	}
}

import java.util.*;
public class Lucky_Year
{
    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        int n=ob.nextInt();
        String s=n+"";
        String next;
        if(s.charAt(0)!='9')
        next=(char)(s.charAt(0)+1)+"";
        else
        next="10";
        for(int i=1;i<s.length();i++)
        next+="0";
        int ne=Integer.parseInt(next);
        System.out.println(ne-n);
    }
}

import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb=new Scanner(System.in);
		while(kb.hasNext()){
			long n=kb.nextInt();
			if(n<=9){
				System.out.println(1);
			}else{
				long i=1;
				while(i<=n){
					i=i*10;
				}
				i=i/10;
				if(n%i==0){
					System.out.println(i);
				}else{
					System.out.println(((n/i)+1)*i-n);
				}
			}

		}
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Luck_Year {
	static long powers[] = {
		1,
		10,
		100,
		1000,
		10000,
		100000,
		1000000,
		10000000,
		100000000,
		1000000000,
	};

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();

		long n = sc.nextLong();

		int i = 0;

		while(true) {
			if (powers[i] > n)
			{
				i--;
				break;
			}
			else if (powers[i] == n)
				break;

			i++;
		}

		long rem = (int) (n / powers[i]);
		rem += 1;
		rem *= powers[i];
		long res = rem - n;
		System.out.println(res);

	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}

import java.util.*;
public class Works {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String n = in.next();
        long count = 0;
        long num = 0;
        if (n.length() > 1 && Character.getNumericValue(n.charAt(0)) == sumString(n)) {
         count = Integer.parseInt(String.valueOf((int)(1 * Math.pow(10,n.length()-1))));
        }
        else if (n.length() <= 1) count++;
        else {
            num = Integer.parseInt(Character.getNumericValue(n.charAt(0))+1 +"" + addZero(n));
            count = num - Integer.parseInt(n);
        }
        System.out.println(count);
    }

    private static String addZero(String n) {
        String out = "";
        for (int i = 0; i < n.length()-1; i++)
        out+="0";
        return out;
    }

    private static int sumString(String n) {
    int sum = 0;
        for (int i = 0; i < n.length(); i++)
            sum+=Character.getNumericValue(n.charAt(i));
        return sum;
    }
}

import java.util.*;
import java.io.*;

public class A {
	public static void main(String[] args){
		Scanner s  = new Scanner(System.in);
		int year = s.nextInt();
		int start = year;
		int digits = Integer.toString(year).length() - 1;
		System.out.println((int)((year/((int)Math.pow(10, digits)))+1) * (int)Math.pow(10, digits) - start);

	}
}

import java.util.Scanner;

/**
 * Created by phuoc on 6/28/17.
 */

public class LuckyYear {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String year = in.next();
        int numYear = Integer.parseInt(year);
        char[] yearArray = year.toCharArray();
        int nextLuckyYear = Integer.parseInt("" + yearArray[0]);
        nextLuckyYear++;
        while (nextLuckyYear < numYear) {
            nextLuckyYear = nextLuckyYear * 10;
        }
        System.out.println(nextLuckyYear - numYear);
    }

}

import java.util.Scanner;
import java.lang.Math;

public class ScannerUserInput {
    public static void main(String[] args) {
        int year;
        Scanner sc = new Scanner(System.in);
        year  = sc.nextInt();

        int ansYear;
        int x=0;
        if(year <= 9) System.out.println(1);
        else {
            int temp = year, count=-1;
            while(temp != 0) {
                count++;
                if(temp < 10) x = temp;
                temp/=10;
            }
            ansYear = ((x + 1) * (int)Math.pow(10, count)) - year;
            System.out.println((int)ansYear);
        }

    }

}

import java.util.Scanner;

/**
 *
 * @author Tonmoy
 */
public class Lucky_Year_808A {
    public static void main(String[] args) {
        Scanner In=new Scanner (System.in);
        int n=In.nextInt();
        int t=0;
        int y=n;
        int temp = 0;
        while(n!=0){
           temp=n%10;
            n=n/10;
           t++;
        }
        int m=(int)Math.pow(10,t-1);
        int x=(temp+1)*m;
        System.out.println(x-y);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main(String[] args) throws IOException {
BufferedReader z=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(z.readLine());

if(n>=1 && n<=9)
            System.out.println(1);
else{
    String s=n+"";
    int zero=s.length();
    int a=Integer.parseInt(""+s.charAt(0));
    System.out.println((int)((a+1)*Math.pow(10,zero-1))-n);
}

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	private static final int Max=(int) (1e5+10);
	private static long n;
	public static void main(String[] args) throws Exception{
		InitData();
		GetAns();
	}
	private static void InitData() throws Exception{
		SC cin=new SC(System.in);
		n=cin.nextLong();
	}
	private static void GetAns(){
		if(n<10){
			System.out.println(1);
		}else{
			long x=n;
			long temp=0;
			long ans=1;
			while(n>0){
				temp=n%10;
				n/=10;
				ans*=10;
			}
			System.out.println((temp+1)*(ans/10)-x);
		}
	}

	static class SC
	{
		BufferedReader br;
		StringTokenizer st;
		SC(InputStream s)
		{
			br = new BufferedReader(new InputStreamReader(s));
		}
		String next() throws IOException
		{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		int nextInt() throws NumberFormatException, IOException
		{
			return Integer.parseInt(next());
		}
		long nextLong() throws NumberFormatException, IOException
		{
			return Long.parseLong(next());
		}
	}

}

import java.util.*;
public class Problem {

	public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       String n= sc.nextLine();
       //if(n.length()==1)System.out.println(1);

     //  else{
    	//   int i=0;
    	  // for(i=Integer.parseInt(n)+1;!isLucky(""+i);i++){

       //}
       String i=(Integer.parseInt(n.charAt(0)+"")+1)+n.substring(1);

       System.out.println(Integer.parseInt(i)-Integer.parseInt(n)-Integer.parseInt(n)%(int)(Math.pow(10, n.length()-1)));
    }
}

import java.util.*;

public class Solution_1 {
	public static void main(String[] args) {
//		solution start :-)

		// lucky year
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n>=1 && n<=9) System.out.println("1");
		else {
			String s = Integer.toString(n);
			int le = s.length();
			int fi = Integer.parseInt(String.valueOf(s.charAt(0)))+1;
			///System.out.println(fi*(Math.pow(10,le-1)));
			System.out.println((int)(fi*(Math.pow(10,le-1))-n));

		}

//		solution end \(^-^)/
//		                |
//		               / \
		}
	}

import java.util.*;

public class demo {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.next();
        long value = Long.valueOf(str);
        if(value < 10){
            System.out.println(1);return;
        }
        String string = "1";
        for(int i = 1 ; i < str.length() ; i++){
            string += "0";
        }
        int num = Integer.parseInt(string);
        while (true){
            if(value - num < 0){
                System.out.println(Math.abs(value - num));
                return;
            }
            else{
                num += Integer.parseInt(string);
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class LuckyYear
{

    public static void main(String[] args)
    {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        long x = sc.nextLong();
        String s = x+"";
        int length = s.length();

        long a = (long)Math.pow(10, length) / 10 ;

        out.print( a - x%a  );
        out.close();

        }
    }

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        try	{
            br = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer("");
        } catch (Exception e){e.printStackTrace();}
    }

    public String next() {
        if (st.hasMoreTokens())	return st.nextToken();
        try {st = new StringTokenizer(br.readLine());}
        catch (Exception e) {e.printStackTrace();}
        return st.nextToken();
    }

    public int nextInt() {return Integer.parseInt(next());}

    public long nextLong() {return Long.parseLong(next());}

    public double nextDouble() {return Double.parseDouble(next());}

    public String nextLine() {
        String line = "";
        try {line = br.readLine();}
        catch (Exception e) {e.printStackTrace();}
        return line;
    }

    public Integer[] nextIntegerArray(int n) {
        Integer[] a = new Integer[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public char[] nextCharArray() {
        return nextLine().toCharArray();
    }
}

import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		int x=n;
		int d = 0;
		int s=0;
		while(n!=0){
		   d++;
           if(n/10==0) s=n;
		   n=n/10;
		}
		s++;
		for(int i=1;i<d;i++) s=s*10;
		System.out.println(s-x);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class LuckyYear {

	static int nextLucky(int yr)
	{
		int now=yr;
		int c=0;
		int just=0;
		while(yr>0)
		{
			just=yr%10;
			c++;
			yr=yr/10;
		}
		String s = String.valueOf(just+1);
		int n = s.length();
		for(int i=n;i<=n+c-2;i++)
		{
			s=s+"0";
		}
		return Integer.parseInt(s)-now;
	}

	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int yr = Integer.parseInt(br.readLine());
		System.out.println(nextLucky(yr));
	}

}

import java.util.Scanner;

public class Main
{
    public static boolean isLuckyYear(String year)
    {
        int length = year.length();
        int non_zero = 0;
        for (int i = 0;i < length ; i++)
        {
            if (year.charAt(i) != '0')
                non_zero++;
            if (non_zero >1)
                return false;
        }
        return true;
    }
    public static String nextLuckyYear(String nowYear)
    {
        if (nowYear.length() == 1)
            return "1";
        int length = nowYear.length();
        if (isLuckyYear(nowYear))
        {
            StringBuilder ans = new StringBuilder("1");
            for (int i = 0; i < length-1; i++)
            {
                ans = ans.append('0');
            }
            return ans.toString();
        }

        int first = nowYear.charAt(0) - '0';
        first++;
        StringBuilder ans = new StringBuilder(""+first);
        for (int i = 1; i <= length-1; i++)
        {
            ans = ans.append('0');
        }
        int t = Integer.parseInt(ans.toString()) - Integer.parseInt(nowYear);
        return ""+t;
    }
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String nowYear = sc.nextLine();
        System.out.println(nextLuckyYear(nowYear));
    }
}

//Do what you can't.
//MAY13D

import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class ECR21A {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter w = new PrintWriter(System.out);
    long n=in.nextInt();
    String s=Long.toString(n);
    if (s.length()==1)
      w.println(1);
    else{
    long div1=(long)Math.pow(10,s.length()-1);
    //System.out.println("div1 is : "+div1);
    long dv=(n/(long)Math.pow(10,s.length()-1))+1;
    //System.out.println("dv is : "+dv);
    if (n>=Long.toString(div1).length()){
      //div1=(long)Math.pow(10,s.length());
      div1=dv*div1;
    }

    //System.out.println("div1 is : "+div1);
    w.println(div1-n);
  }
    w.close();
    }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int snext() {
      if (snumChars == -1)
      throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0)
        return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c))
      c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null)
      return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}

import java.io.*;

public class Lucky2 {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    long y = Long.parseLong(in.readLine());
    long pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      long h = 1;
      long l = 0;
      long t = 0;
      while(h * 10 <= y){
        long u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
        long g = y;
        boolean ppp = true;
        while(g > 10){
          if(g % 10 != 0){
            ppp = false;
          }
          g = g / 10;
        }
        if(ppp){ break; }
      }

    System.out.println(y-pp);
  }}
}

import java.util.*;

public class luckyyr {
   public static void main (String[] args) {
      Scanner sc = new Scanner(System.in);
      int yr = sc.nextInt();
      int j = 0;
      if (yr < 10) {
         System.out.println(1);
      }
      else {
         for (int i = 0; i > -1; i++) {
            if (Math.pow(10, i) > yr) {
               j = i - 1;
               break;
            }
         }

         int num = (int)(yr / Math.pow(10, j));
         int h = (int)((num + 1) * Math.pow(10, j));
         System.out.println(h - yr);
      }
   }
}

import java.util.*;
public class Lucky_Year
{
    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        int n=ob.nextInt();
        String s=n+"";
        String next;
        if(s.charAt(0)!='9')
        next=(char)(s.charAt(0)+1)+"";
        else
        next="10";
        for(int i=1;i<s.length();i++)
        next+="0";
        int ne=Integer.parseInt(next);
        System.out.println(ne-n);
    }
}

import java.util.Scanner;

public class luckey_year{

    static String string = "1";
    static Scanner scanner = new Scanner(System.in);
    static int n;

    public static void main(String args[]) {

        n = scanner.nextInt();

        if( n < 10)
        {

            System.out.println(1);
            return;

        }

        int length = Integer.toString(n).length();

        for(int i = 1; i < length; ++i)
            string += '0';

        int k = n / Integer.parseInt(string);
        if(k == 9)
            string += '0';

        else
            string = (k + 1) + string.substring(1);

        System.out.println();

        System.out.println(Integer.valueOf(string) - n);

    }

}

//package A;
// In the name of Allah
// Haj_Vahid

import java.util.Scanner;

public class LuckyYear {
    static long dahgan = 0;
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        long n = s.nextLong();

        long nums = findNums(n);

        long dah = 1;

        for (int i=1; i<nums; i++){
            dah *= 10;
        }
        if (nums>1)
            System.out.println((dahgan+1)*dah -n);
        else System.out.println(1);
    }

    public static long findNums(long n) {
        int k = 1;
        while (n/10 != 0){
            k++;
            n = n/10;
            dahgan = n;
        }

        return k;
    }
}

import java.util.*;
import java.io.*;
public class lucky
{
   public static void main(String[] args) throws IOException

   {
      Scanner in=new Scanner(System.in);
      int x=in.nextInt();
      if(x<10)
      {
         System.out.println(""+1);
         System.exit(0);
         }
      else
      {
         for(int a=1; a<10; a++)
         {
            if(x>=Math.pow(10,a)&&x<Math.pow(10,a+1))
            {
               int y=(int)(x/Math.pow(10,a))+1;
               int diff=(int)(y*Math.pow(10,a)-x);
               System.out.println(""+diff);
               System.exit(0);

            }
         }

      }

   }
}

import java.util.Scanner;

public class Luckyyear {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		String s = input.next();

		String p ="";
		if(s.charAt(0)!='9')p = (char)( s.charAt(0)+1)+"";
		else
			p = "10";
		for(int i=0; i<s.length()-1;i++)p+='0';
       // System.out.println(p);
		System.out.println(Integer.parseInt(p)-Integer.parseInt(s));
	}

}

import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		int m=n;
		int count=0;
		long ans=1;
		if(n<10) {
			System.out.print(1);
		}

		else {
			while(m>=10) {
				m=m/10;
				ans*=10;
			}
			ans*=(m%10+1);

			System.out.print(ans-n);
		}

	}

}

import java.util.*;
import java.io.*;

public class A {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	public void solve() {
		long n = in.nextInt();
		long[] x = {10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
		int m = 0;
		for (int i = 0; i < x.length; i++) {
			if (n == x[i]) {
				System.out.println(x[i]);
				return;
			}
			if (x[i] / n > 0) {
				m = i;
				break;
			}
		}
		if (m == 0) {
			System.out.println(1);
		} else if ( n % x[m - 1] == 0) {
			System.out.println(x[m - 1]);
		} else {
			System.out.println((n / x[m - 1] + 1) * x[m - 1] - n);
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] args) {
		new A().run();
	}
}

import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb=new Scanner(System.in);
		while(kb.hasNext()){
			long n=kb.nextInt();
			if(n<=9){
				System.out.println(1);
			}else{
				long i=1;
				while(i<=n){
					i=i*10;
				}
				i=i/10;
				if(n%i==0){
					System.out.println(i);
				}else{
					System.out.println(((n/i)+1)*i-n);
				}
			}

		}
	}

}

import java.util.Scanner;
public class Acode{
public static void main(String[] arsg){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int i,j=n,k=1,a=n;
while(a>=10){
k=k*10;
a=j/k;
}
j=(a+1)*k;
j=j-n;
System.out.println(j);
}
}

import java.lang.String;
import java.util.Scanner;
public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
                     int year;
                    year = input.nextInt();
                    int add = 0;
                    String buffer = Integer.toString(year);
                    if(buffer.length() == 1)
                    {
                        add = 1;
                    }
                    else if(buffer.length() != 1)
                    {
                        double first_num = year / (Math.pow(10,(buffer.length()-1)));
                        double next_lucky = ( (int)first_num + 1 ) * Math.pow ( 10 ,(buffer.length()-1));
                        add = (int)next_lucky - year;
                    }

                    System.out.println(add);

    }

}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();

		if(n<10) {
			System.out.println("1");
		}
//		else if(n>=5&&n<10) {
//			System.out.println(10-n);
//		}
		else {
//			400=> 500
//			5000=>6000
//			23000=>30000
//			201 => 300
//			200=>300

			int d=0;
			int cn=n;
			int ans=0;
			while(cn!=0) {
				d++;
				ans=cn%10;
				cn=cn/10;
			}

			int[] ar= new int[d];
			ar[0]=ans+1;
			int i;
			String s="";

			int res=0;
			for(i=0;i<d;i++) {
//				System.out.println(ar[i]);
				res=res*10+ar[i];
			}
			System.out.println(res-n);

		}

	}

}

import java.util.Scanner;

public class LuckyYear
{
    public static void main(String [] args)
    {
        Scanner input = new Scanner(System.in);
        long n = input.nextInt();

        if(n < 10)
            System.out.println(1);
        else
        {
            StringBuilder str = new StringBuilder();
            str.append(n);

            int firstDigit = Character.getNumericValue(str.charAt(0)) + 1;

            if(firstDigit == 10)
                str.setCharAt(0, '1');
            else
                str.setCharAt(0, (char) (firstDigit + '0'));

            for(int i = 1; i < str.length(); i++)
                str.setCharAt(i, '0');

            if(firstDigit == 10)
                str.append(0);

            System.out.println(Math.abs(Long.parseLong(str.toString())) - n);
        }
    }
}

import java.util.Scanner;

public class LuckyYear {
    public static String nicle(int len) {
        String nic = "";
        for(int i = 0; i < len; i++)
            nic += "0";
        return nic;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if (n < 10)
            System.out.println("1");

        else {
            String bla = Integer.toString(n);
            String upper = "";

            if (bla.charAt(0) != '9') {
                char first = (char)(bla.charAt(0) + 1);
                upper = first + nicle(bla.length()-1);
            }
            else
                upper = "1" + nicle(bla.length());

            System.out.println(Integer.valueOf(upper) - Integer.valueOf(bla));
        }
    }
}

import java.util.*;

public class A808 {
	public static long power(long cnt) {
		long ret=1;
		for(long i=1;i<=cnt;i++) {
			ret*=10;
		}
		return ret;
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		long a=scan.nextLong();
		long temp=a;
		long cnt=0;
		while(a>=10) {
			a=a/10; cnt++;
		}
		long val=power(cnt);
		long ans=(a+1)*val;
		System.out.println(ans-temp);
		scan.close();
	}
}

 import java.util.*;
public class Main{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int T = (int) Math.floor(Math.log10(N));
        int P = (int) Math.pow(10, T);
        int C = P - (N % P);
        C = (C == 0) ? P : C;
        System.out.print(C);

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args){
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt();
		if(n == 1000000000) {
			out.println(1000000000);
			out.close();
			return;
		}
		ArrayList<Integer> a = new ArrayList<Integer>();
		int t = 1;
		while(t < 10){
			a.add(t);
			t++;
		}
		while(t < 100){
			a.add(t);
			t+=10;
		}
		while(t < 1000){
			a.add(t);
			t+=100;
		}
		while(t < 10000){
			a.add(t);
			t+=1000;
		}
		while(t < 100000){
			a.add(t);
			t+=10000;
		}
		while(t < 1000000){
			a.add(t);
			t+=100000;
		}
		while(t < 10000000){
			a.add(t);
			t+=1000000;
		}
		while(t < 100000000){
			a.add(t);
			t+=10000000;
		}
		while(t <= 1000000000){
			a.add(t);
			t+=100000000;
		}
		for(int i = 0;; i++){
			if(a.get(i) > n){
				out.println(a.get(i)-n);
				break;
			}
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.util.*;
public class div469{
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if(n<10){
			System.out.println("1");
		}else{
		ArrayList<Long> al = new ArrayList<>();
		if(5>n)
		al.add(5-n);
		if(100>n)
		al.add(100-n);
		if(40000>n)
		al.add(40000-n);
		String st  = String.valueOf(n);
		int length = st.length();
		long val = (int)st.charAt(0)-48;
		if(val==9){
			length+=1;
			val=1;
		}else{
			val+=1;
		}
		for(int i=0;i<length-1;i++){
			val*=10;
		}
		al.add(val-n);
		Collections.sort(al);
		long min = Long.MAX_VALUE;
		for(int i=0;i<al.size();i++){
			if(al.get(i)<min && al.get(i)>0)
				min=al.get(i);
		}
		System.out.println(min);}
	}
}

import java.util.Scanner;

/**
 * Created by phuoc on 6/28/17.
 */

public class LuckyYear {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String year = in.next();
        int numYear = Integer.parseInt(year);
        int nextLuckyYear = Integer.parseInt(year.substring(0, 1));
        nextLuckyYear++;
        while (nextLuckyYear < numYear) {
            nextLuckyYear = nextLuckyYear * 10;
        }
        System.out.println(nextLuckyYear - numYear);
    }
}

import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input= new Scanner(System.in);
		int n = input.nextInt();
		String str= Integer.toString(n);
		int m=n;
		if(n<10){
			System.out.println(1);
		}else{
			int length=str.length();
			for(int i=1;i<=length-1;i++){
				m=m/10;
			}
			int temp=m+1;
			for(int i=1;i<=length-1;i++){
				temp*=10;
			}
			System.out.println(temp-n);
		}
	}

}

import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if (n <= 9) {
            System.out.println(1);
            return;
        }
        int len = dig(n);
        int a =  n  / power(10, len - 1);
        a++;
        System.out.println(a * power(10, len - 1) - n);
    }

     public static int power(int a, int b) {
        int res = 1;
        while (b > 0) {
            if (b % 2 != 0) {
                res = mul(a, res);
            }
            b >>= 1;
            a = mul(a, a);
        }
        return res;
    }

    public static int mul(int a, int b) {
        return a * b;
    }

    public static int dig(int n) {
        int res = 0;
        while (n > 0) {
            n /= 10;
            res++;
        }
        return res;
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Alexander Tsupko (alexander.tsupko@outlook.com)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = String.valueOf(n);
            char[] c = s.charAt(0) == '9' ? new char[s.length() + 1] : new char[s.length()];
            Arrays.fill(c, '0');
            c[0] = s.charAt(0) == '9' ? '1' : (char) (s.charAt(0) + 1);
            out.print(Integer.parseInt(new String(c)) - n);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buffer = new byte[1024];
        private int current;
        private int size;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private int read() {
            if (size == -1) throw new InputMismatchException();
            if (current >= size) {
                current = 0;
                try {
                    size = stream.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0) return -1;
            }
            return buffer[current++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceCharacter(c)) c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int result = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                result *= 10;
                result += c - '0';
                c = read();
            } while (!isSpaceCharacter(c));
            return result * sign;
        }

        private boolean isSpaceCharacter(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sid
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        A808 solver = new A808();
        solver.solve(1, in, out);
        out.close();
    }

    static class A808 {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            int year = in.nextInt();
            int g = year;
            int count = 0;
            while (g >= 10) {
                g = g / 10;
                count++;
            }
            int nearest = 1;
            while (count > 0) {
                nearest = nearest * 10;
                count--;
            }
            nearest *= (g + 1);
            out.println(nearest - year);

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.math.BigInteger;
import java.util.*;
import java.io.*;

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
        FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }
        String next() { while (st == null || !st.hasMoreElements()) {
            try { st = new StringTokenizer(br.readLine()); }
            catch (IOException e) { e.printStackTrace(); } }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }

        String nextLine() {
            String str = "";
            try { str = br.readLine(); }
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        FastReader ip = new FastReader();
        OutputStream output = System.out;
        PrintWriter out = new PrintWriter(output);
        int n=ip.nextInt();
        String s=Integer.toString(n);
        int f=(Character.getNumericValue(s.charAt(0))+1);
        String str="";
        for(int i=1;i<s.length();i++){
            str+='0';
        }
        String s1=f+str;
        out.print(Integer.parseInt(s1)-n);

        out.close();
    }
}

import java.util.Scanner;

public class Luckyyear {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		String s = input.next();

		String p ="";
		if(s.charAt(0)!='9')p = (char)( s.charAt(0)+1)+"";
		else
			p = "10";
		for(int i=0; i<s.length()-1;i++)p+='0';
       // System.out.println(p);
		System.out.println(Integer.parseInt(p)-Integer.parseInt(s));
	}

}

import java.io.*;

public class Lucky2 {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    long y = Long.parseLong(in.readLine());
    long pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      long h = 1;
      long l = 0;
      long t = 0;
      while(h * 10 <= y){
        long u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
        if(y == h*10){break;}
      }

    System.out.println(y-pp);
  }}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main(String[] args) throws IOException {
BufferedReader z=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(z.readLine());
if(n==1)
            System.out.println(1);
        else if(n < 5 && n > 1)
            System.out.println(5-n);
else if(n==5 || n==6 |n==7 || n==9)
    System.out.println(10-n);
else if(n==8)
    System.out.println(1);
else{
    String s=n+"";
    int zero=s.length();
    int a=Integer.parseInt(""+s.charAt(0));
    System.out.println((int)((a+1)*Math.pow(10,zero-1))-n);
}

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sid
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        A808 solver = new A808();
        solver.solve(1, in, out);
        out.close();
    }

    static class A808 {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            int year = in.nextInt();
            int g = year;
            int count = 0;
            while (g > 10) {
                g = g / 10;
                count++;
            }
            int nearest = 1;
            while (count > 0) {
                nearest = nearest * 10;
                count--;
            }
            nearest *= (g + 1);
            out.println(nearest - year);

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.util.*;
import java.io.*;
public class Lucky_Year
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		int year=Integer.parseInt(f.readLine());
		long num=1;
		while(num*10<year)
			num*=10;
		long temp=(year/num+1)*num;
		System.out.println(temp-year);
	}
}

//*******************************************************************
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************

import java.lang.Math; // headers MUST be above the first class
import java.util.Scanner;
// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    Scanner nhapDuLieu = new Scanner(System.in);
    int n = nhapDuLieu.nextInt();
    int result = 0;
    if (n<10)
     	result = 1;
    else if (n%10 == 0)
    	result = 10 + LuckyYear(n/10)*10;
    else
      	result = LuckyYear(n);
	System.out.print(result);
  }

  public static int LuckyYear(int n)
  {
   	if (n/10 == 0)
    {
     	return 0;
    }
    else if (n%10 == 0){
      	return 9 + LuckyYear(n/10)*10;
    }
    else {
     	return (10 - n%10) + LuckyYear(n/10)*10;
    }
  }
}

// you can add other public classes to this editor in any order

import java.util.*;
import java.io.*;

public class A {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	public void solve() {
		long n = in.nextInt();
		if (n == 10) {
			System.out.println(n);
			return;
		}
		long[] x = {10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
		int m = 0;
		for (int i = 0; i < x.length; i++) {
			if (x[i] / n > 0) {
				m = i;
				break;
			}
		}
		if (m == 0) {
			System.out.println(1);
		} else if ( n % x[m - 1] == 0) {
			System.out.println(x[m - 1]);
		} else {
			System.out.println((n / x[m - 1] + 1) * x[m - 1] - n);
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] args) {
		new A().run();
	}
}

import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		if(a<5)
			System.out.print(""+(5-a));
		else if(a==5)
			System.out.print("5");
		else{
		int t = a;
		int c = -1;
		while(a>0){
			c++;
			a/=10;
		}
		int t1 = ((int)t/(int)Math.pow(10, c))+1;
		int t2 = (t1*(int)Math.pow(10, c)-t);
		System.out.print(""+t2);
		}
	}
}

import java.util.*;
public class div469{
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n<10){
			System.out.println("1");
		}else{
		ArrayList<Integer> al = new ArrayList<>();
		al.add(5-n);
		al.add(100-n);
		al.add(40000-n);
		String st  = String.valueOf(n);
		int length = st.length();
		int val = (int)st.charAt(0)-48;
		if(val==9){
			length+=1;
			val=1;
		}else{
			val+=1;
		}
		for(int i=0;i<length-1;i++){
			val*=10;
		}
		al.add(val-n);
		Collections.sort(al);
		int min = Integer.MAX_VALUE;
		for(int i=0;i<al.size();i++){
			if(al.get(i)<min && al.get(i)>=0)
				min=al.get(i);
		}
		System.out.println(min);}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		int n = input.nextInt();
		if (n < 10)
		{
			System.out.println(1);
		} else if (n < 100)
		{
			System.out.println(10 - (n % 10));
		} else if (n < 1000)
		{
			System.out.println(100 - (n % 100));
		} else if (n < 10000)
		{
			System.out.println(1000 - (n % 1000));
		} else if (n < 100000)
		{
			System.out.println(10000 - (n % 10000));
		} else if (n < 1000000)
		{
			System.out.println(100000 - (n % 100000));
		} else if (n < 10000000)
		{
			System.out.println(1000000 - (n % 1000000));
		} else if (n < 100000000)
		{
			System.out.println(10000000 - (n % 10000000));
		} else if (n < 100000000)
		{
			System.out.println(100000000 - (n % 100000000));
		}
	}
}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();

		if(n<5) {
			System.out.println(5-n);
		}
		else if(n>=5&&n<10) {
			System.out.println(10-n);
		}
		else {
//			400=> 500
//			5000=>6000
//			23000=>30000
//			201 => 300
//			200=>300

			int d=0;
			int cn=n;
			int ans=0;
			while(cn!=0) {
				d++;
				ans=cn%10;
				cn=cn/10;
			}

			int[] ar= new int[d];
			ar[0]=ans+1;
			int i;
			String s="";

			int res=0;
			for(i=0;i<d;i++) {
//				System.out.println(ar[i]);
				res=res*10+ar[i];
			}
			System.out.println(res-n);

		}

	}

}

import java.util.Scanner;

/**
 * Created by iskuskov on 15.05.17.
 */
public class ProblemA {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int power = 1;
    while (power <= n) power *= 10;
    power /= 10;

    int k = (n / power + 1) * power;
    System.out.println(k - n);
  }
}

import java.util.Scanner;
public class main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String year,str="";
        int year1,year2,len;
        year = input.nextLine();
        len = year.length();
        int i,result=0;
        if(len>2)
        {
            for(i=1;i<len;i++)str+=year.charAt(i);
            year1 = Integer.parseInt(str);
            year2 = Integer.parseInt(year);
            if(year2<100&&year2>=10)result = 100-year2;
            else if(len==3)result=100-year1;
            else if(len==4)result=1000-year1;
            else if(len==5)result=10000-year1;
            else if(len==6)result=100000-year1;
            else if(len==7)result=1000000-year1;
            else if(len==8)result=10000000-year1;
            else if(len==9)result=100000000-year1;
            System.out.println(result);
        }
        else if (len==2)
        {
            year2 = Integer.parseInt(year);
            if(year2>=10&&year2<20)System.out.println(20-year2);
            else if(year2>=20&&year2<30)System.out.println(30-year2);
            else if(year2>=30&&year2<40)System.out.println(40-year2);
            else if(year2>=40&&year2<50)System.out.println(50-year2);
            else if(year2>=50&&year2<60)System.out.println(60-year2);
            else if(year2>=60&&year2<70)System.out.println(70-year2);
            else if(year2>=70&&year2<80)System.out.println(80-year2);
            else if(year2>=80&&year2<90)System.out.println(90-year2);
            else if(year2>=90&&year2<100)System.out.println(100-year2);
        }
        else {
            year1 = Integer.parseInt(year);
            System.out.println("1");
        }

    }

}

import java.util.*;
public class luckyear {

    public static boolean zero(String s ){
    	for(int i=1 ; i<s.length();i++){
    		if (s.charAt(i)!='0')
    			return false;
    	}
    	return true ;
    }
    public static String go(String s){
    	String news="";
    	if(s.charAt(s.length()-1)!='0')
    	 news=(10-Character.getNumericValue(s.charAt(s.length()-1)))+"" ;
    	else
    		news=0+"";
    	if (s.length()==1)
    		return (Character.getNumericValue(s.charAt(0))+1)+"";
    	else if (zero(s))
    		return "1000";
    	else
    	{
    		for(int i =s.length()-2 ; i>0;i--){
    			int j = 1 ;
    			char c = s.charAt(i);
    			news = (10-j-Character.getNumericValue(c))+news;
    		}
    	}
    	return news ;
    }
    public static void main (String [] args) {
    	Scanner  sc = new Scanner(System.in);
    	String s = sc.nextLine();
    	System.out.print(go(s));
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	private static final int Max=(int) (1e5+10);
	private static int n;
	public static void main(String[] args) throws Exception{
		InitData();
		GetAns();
	}
	private static void InitData() throws Exception{
		SC cin=new SC(System.in);
		n=cin.nextInt();
	}
	private static void GetAns(){
		if(n<10){
			System.out.println(1);
		}else{
			int x=n;
			int temp=0;
			int ans=1;
			while(n>0){
				temp=n%10;
				n/=10;
				ans*=10;
			}
			System.out.println((temp+1)*(ans/10)-x);
		}
	}

	static class SC
	{
		BufferedReader br;
		StringTokenizer st;
		SC(InputStream s)
		{
			br = new BufferedReader(new InputStreamReader(s));
		}
		String next() throws IOException
		{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		int nextInt() throws NumberFormatException, IOException
		{
			return Integer.parseInt(next());
		}
		long nextLong() throws NumberFormatException, IOException
		{
			return Long.parseLong(next());
		}
	}

}

import java.util.*;

public class CodeForces {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int b=0;
       int k=1;
       if(n<10)System.out.println("1");
       else{
       for(;;){
           n++;
           b=b+k;
           if(n%2==0&&n%5==0){
               n=n/10;
               k=k*10;
           }
           else if(n/10<1)break;
       }
           System.out.println(b-k);
    }
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class main {
	static long n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (line.length() == 1) {
			System.out.println(Integer.parseInt(line) + (1));
		} else {
			int p = 1;
			for (int i = 0; i < line.length()-1; i++) {
				p = p * 10;
			}
			int result = p *( Character.getNumericValue(line.charAt(0))+1);
			System.out.println(result - Integer.parseInt(line));
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class main {
	static int n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (line.length() == 1) {
			System.out.println(Integer.parseInt(line) + (1));
		} else {
			int p = 1;
			for (int i = 0; i < line.length()-1; i++) {
				p = p * 10;
			}
			int result = p *( Character.getNumericValue(line.charAt(0))+1);
			System.out.println(result - Integer.parseInt(line));
		}
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.*;

/**
 *
 * @author Deibu
 */
public class Luckyear {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Input: ");
        int input = in.nextInt();
        String str = "" + input;
        String op = "";

        char c1 = 0;
        char c = 0;
        int g = 0;
        c1 = str.charAt(0);
        if (c1 != '9') {
            g = (int) c1;
            g += 1;
            op += (char) g;
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        } else {
            op += "10";
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        }
        System.out.println("Output");
        int s;
        s = Integer.valueOf(op);
        System.out.println( s - input);

    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class main {
	static long n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (line.length() == 1) {
			System.out.println(Integer.parseInt(line) + (1));
		} else {
			long p = 1;
			for (int i = 0; i < line.length()-1; i++) {
				p = p * 10;
			}
			long result = p *( Character.getNumericValue(line.charAt(0))+1);
			System.out.println(result - Integer.parseInt(line));
		}
	}
}

import java.io.*;
import java.util.*;
public class luck{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String N = Integer.toString(n);

      System.out.print(Character.getNumericValue(N.charAt(0))+1);
      for(int i=0; i<N.length()-1; i++){
      System.out.print("0");
      }
   }
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException
    {
        // StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        FastScanner sc = new FastScanner();
        String s=sc.next();
        if(s.length()<=1)
        {
            out.println(Integer.parseInt(s)+1);
        }
        else
        {
            StringBuilder s2=new StringBuilder();
            if(s.charAt(0)<='8')
            {
                s2.append((char)(s.charAt(0)+1));
                for(int i=1;i<s.length();i++)
                    s2.append('0');
            }
            else
            {
                s2.append('1');
                for(int i=0;i<s.length();i++)
                {
                    s2.append('0');
                }
            }
            out.println(Integer.parseInt(s2.toString())-Integer.parseInt(s));
        }

        out.flush();

    }
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        private FastScanner() {
            try	{
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }
        private boolean hasNextToken()
        {
            if(st.countTokens()!=StreamTokenizer.TT_EOF)
            {
                return true;
            }
            else
                return false;
        }
        private String next() {
            if (st.hasMoreTokens())	return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }
        private BigInteger nextBigInteger(){return new BigInteger(next());}
        private BigDecimal nextBigDecimal(){return new BigDecimal(next());}
        private  int nextInt() {return Integer.parseInt(next());}
        private long nextLong() {return Long.parseLong(next());}
        private double nextDouble() {return Double.parseDouble(next());}
        private String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
        private int[] nextIntArray(int n) {
            int[] a = new int[n];
            for(int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }
        private long[] nextLongArray(int n){
            long[] a = new long[n];
            for(int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }
        private double[] nextDoubleArray(int n){
            double[] a = new double[n];
            for(int i = 0; i < n; i++) a[i] = nextDouble();
            return a;
        }
        private char[][] nextGrid(int n, int m){
            char[][] grid = new char[n][m];
            for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
            return grid;
        }
        private void sort(int arr[])
        {
            int cnt[]=new int[(1<<16)+1];
            int ys[]=new int[arr.length];
            for(int j=0;j<=16;j+=16){
                Arrays.fill(cnt,0);
                for(int x:arr){cnt[(x>>j&0xFFFF)+1]++;}
                for(int i=1;i<cnt.length;i++){cnt[i]+=cnt[i-1];}
                for(int x:arr){ys[cnt[x>>j&0xFFFF]++]=x;}
                { final int t[]=arr;arr=ys;ys=t;}
            }
            if(arr[0]<0||arr[arr.length-1]>=0)return;
            int i,j,c;
            for(i=arr.length-1,c=0;arr[i]<0;i--,c++){ys[c]=arr[i];}
            for(j=arr.length-1;i>=0;i--,j--){arr[j]=arr[i];}
            for(i=c-1;i>=0;i--){arr[i]=ys[c-1-i];}
        }
        private  long gcd(long a, long b) {return b == 0 ? a : gcd(b, a%b);}
    }

}

import java.util.Scanner;

/**
 * Created by JORGE on 5/19/2017.
 */
public class Exe {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        long year = in.nextLong();
        long temp = year;
        long sum = 1;
        for(long place = 1l; temp>9; place++) {
            temp /= 10;
            sum*=10;
        }

        long goal = (year/2*2)+sum;
        System.out.println(goal-year);
    }
}

 import java.util.*;
public class Main{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int T = (int) Math.floor(Math.log10(N));
        System.out.print((int) Math.pow(10, T));

    }
}

import java.util.*;
import java.io.*;
public class Lucky_Year
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		int year=Integer.parseInt(f.readLine());
		long num=1;
		while(num*10<year)
			num*=10;
		long temp=(year/num+1)*num;
		System.out.println(temp-year);
	}
}

import java.util.Scanner;

public class A_LuckyYear {
  public static long nextLuckeyYear(final long year) {
    if (year < 10) {
      return 1L;
    }

    long pow = 10;
    while (year - (year % pow) * pow > 0) {
      pow *= 10;
    }

    pow = pow / 10;
    final long delta = (year / pow + 1) * pow;
    return delta - year;
  }

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final long input = scanner.nextLong();
    System.out.println(nextLuckeyYear(input));
    // System.out.println("next year: " + nextLuckeyYear(5));
    // System.out.println("next year: " + nextLuckeyYear(201));
    // System.out.println("next year: " + nextLuckeyYear(4000));
  }
}

import java.io.*;

public class Lucky {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    long y = Long.parseLong(in.readLine());
    long pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      long h = 1;
      long l = 0;
      long t = 0;
      while(h * 10 <= y){
        long u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
      }

    System.out.println(y-pp);
  }}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class main {
	// static long n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (line.length() == 1) {
			System.out.println(Integer.parseInt(line) + (1));
		} else {
			BigInteger b = new BigInteger("1");
			long p = 1;
			for (int i = 0; i < line.length() - 1; i++) {
				// p = p * 10;
				b = b.multiply(new BigInteger("10"));
			}
			long result = p * (Character.getNumericValue(line.charAt(0)) + 1);
			b = b.multiply(new BigInteger(String.valueOf(Character.getNumericValue(line.charAt(0)) + 1)));
			System.out.println(b.subtract(new BigInteger(line)));
		}
	}
}

import java.util.*;
public class luckyear {

    public static boolean zero(String s ){
    	for(int i=1 ; i<s.length();i++){
    		if (s.charAt(i)!='0')
    			return false;
    	}
    	return true ;
    }
    public static String go(String s){
    	String news="";
    	if(s.charAt(s.length()-1)!='0')
    	 news=(10-Character.getNumericValue(s.charAt(s.length()-1)))+"" ;
    	else
    		news=0+"";
    	if (s.length()==1)
    		return "1";
    	else if (zero(s))
    	{ news = 1+"";
    		for(int i=1 ; i<s.length() ; i++)
    		news+='0';

    		return news ;
    	}
    	else
    	{
    		for(int i =s.length()-2 ; i>0;i--){
    			int j = 1 ;
    			char c = s.charAt(i);
    			news = (10-j-Character.getNumericValue(c))+news;
    		}
    	}
    	return news ;
    }
    public static void main (String [] args) {
    	Scanner  sc = new Scanner(System.in);
    	String s = sc.nextLine();
    	System.out.print(go(s));
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.*;

/**
 *
 * @author Deibu
 */
public class Luckyear {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Input: ");
        int input = in.nextInt();
        String str = "" + input;
        String op = "";
        if (input<1||input>1000000000) {
            System.exit(0);
        }
        char c1 = 0;
        char c = 0;
        int g = 0;
        c1 = str.charAt(0);
        if (c1 != '9') {
            g = (int) c1;
            g += 1;
            op += (char) g;
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        } else {
            op += "10";
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        }
        System.out.println("Output");
        int s;
        s = Integer.valueOf(op);
        System.out.println( s - input);

    }

}

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n=s.nextInt();
		int $0 = 0;
		for (;n%10==0;$0++) {
			n /= 10;
		}
		for (int k=1;true;k++) {
			int d = n+k;
			while (d%10==0) {
				d /= 10;
			}
			if (d%10 == d) {
				System.out.println((int)k*Math.pow(10, $0));
				break;
			}
		}
		s.close();
	}
}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int input = 0;
		int output = 0;

		input = scan.nextInt();

		System.out.println(nextLuckyYear(input));

	}

	public static int nextLuckyYear(int input) {
		int multiplier = 1;
		int result = 0;
		int copy = input;

		while (copy > 10) {
			copy /= 10;
			multiplier *= 10;
		}

		result = copy + 1;

		result *= multiplier;

		return result - input;
	}

}

import java.util.*;

public class Year
{
    public static void main(String[] args)
    {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int odp=0;
		if(n<10) odp=1;
		else
		{
			int u=10;
			while(n>u) u*=10;
			if(n!=10) u=u/10;
			odp=u-(n%u);
		}

		System.out.println(odp);
	}
}

import java.util.Scanner;
import static java.lang.Math.pow;
public class Lucky
{
	public static void main(String args[])
	{
		int m,n,i=0,j,k,p,q,r,s,c=0,m1,m2;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		r=n;
		s=n;
		while(s!=0)
		{m2=s%10;
		 s=s/10;
		 c+=1;
		}
		int a[]=new int[c+1];
		while(n!=0)
		{m=n%10;
		 n=n/10;
		 a[i++]=m;
		}
		q=1;
		for(p=1;p<=i-1;p++)
		{q=q*10;
		}
		if(i==1)
		{System.out.println(a[i-1]+1);
		}
		else
		{k=((a[i-1]+1)*q);
		 m1=k-r;
		 System.out.println(m1);
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author o_panda_o(emailofpanda@yahoo.com)
 */
public class Code_808A_LuckyYear{
    public static void main(String[] args){
        InputStream inputStream=System.in;
        OutputStream outputStream=System.out;
        InputReader in=new InputReader(inputStream);
        OutputWriter out=new OutputWriter(outputStream);
        _808A_ solver=new _808A_();
        solver.solve(1,in,out);
        out.close();
    }

    static class _808A_{
        public void solve(int testNumber,InputReader in,OutputWriter out){
            int n=in.nextInt(), min=Integer.MAX_VALUE;
            for(int i=1;i<=9;++i)
                for(int j=1;j<=1_00_00_00_000;j*=10)
                    if(i*j>n) min=Math.min(min,i*j-n);
            out.print(min);
        }

    }

    static class OutputWriter{
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream){
            writer=new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer){
            this.writer=new PrintWriter(writer);
        }

        public void close(){
            writer.close();
        }

        public void print(int i){
            writer.print(i);
        }

    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf=new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream){
            this.stream=stream;
        }

        public int read(){
            if(numChars==-1){
                throw new InputMismatchException();
            }
            if(curChar>=numChars){
                curChar=0;
                try{
                    numChars=stream.read(buf);
                }catch(IOException e){
                    throw new InputMismatchException();
                }
                if(numChars<=0){
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt(){
            int c=read();
            while(isSpaceChar(c)){
                c=read();
            }
            int sgn=1;
            if(c=='-'){
                sgn=-1;
                c=read();
            }
            int res=0;
            do{
                if(c<'0'||c>'9'){
                    throw new InputMismatchException();
                }
                res*=10;
                res+=c-'0';
                c=read();
            }while(!isSpaceChar(c));
            return res*sgn;
        }

        public boolean isSpaceChar(int c){
            if(filter!=null){
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }

        public interface SpaceCharFilter{
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.*;

public class CodeForces {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int b=0;
       int k=1;
       if(n<10)System.out.println("1");
       else{
       for(;;){
           n++;
           b=b+k;
           if(n%2==0&&n%5==0){
               n=n/10;
               k=k*10;
           }
           else if(n/10<1)break;
       }
           System.out.println(b-k);
    }
}
}//1

import java.io.*;
import java.util.*;

public class cf58{
	public static long isLucky(String n){
       //int mo=0;
		int c=0;
		if(n.length()==1){
			return 1;
		}
        StringBuilder str = new StringBuilder();
        for(long i=0;i<n.length();i++){
        	str.append("0");
        }

        str.append(Character.getNumericValue(n.charAt(0))+1);
        str = str.reverse();
        String s = str.toString();
        Long num = Long.parseLong(s);
        Long ans = Long.parseLong(n);

        return num-ans;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		Long n = sc.nextLong();
		System.out.println(isLucky(String.valueOf(n)));
	}
}

import java.util.*;
public class LuckyYear {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = scan.nextInt();
	int tmp = n;
	int count = 0;
	int zero_count = 0;
	int non_zero_count = 0;
	int prev = tmp*10;
	while(tmp!=0){
		count++;
		if(tmp%10==0){
			zero_count++;
		}else{
			non_zero_count++;
		}
		tmp = tmp/10;
		prev = prev/10;
	}
	if(count == 1){
		System.out.println(1);
	}else{
		if(non_zero_count == 1){
			System.out.println((int)Math.pow(10, count-1));
		}else{
			prev++;
			int tt = prev*(int)Math.pow(10, count-1);
			System.out.println(tt - n*1);
		}
	}
}
}

import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		int m=n;
		int count=0;
		long ans=1;
		if(n<10) {
			System.out.print(1);
		}

		else {
			while(m>=10) {
				m=m/10;
				ans*=10;
			}
			ans*=(m%10+1);
			System.out.print(ans);
			System.out.print(ans-n);
		}

	}

}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
/*
	  br = new BufferedReader(new FileReader("input.txt"));
	  pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
	  br = new BufferedReader(new InputStreamReader(System.in));
	  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		//int qq = 1;
		int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++)	{
			TreeSet<Long> ret = new TreeSet<Long>();
			long n = readInt();
			for(int i = 1; i <= 9; i++) {
				long curr = i;
				while(curr <= n) {
					ret.add(curr);
					ret.add(curr*10);
					curr *= 10;
				}
			}
			pw.println(ret.higher(n) - n);
		}
		exitImmediately();
	}

	private static void exitImmediately() {
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private static int readInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private static String nextLine() throws IOException  {
		String s = br.readLine();
		if(s == null) {
			exitImmediately();
		}
		st = null;
		return s;
	}

	private static String nextToken() throws IOException  {
		while(st == null || !st.hasMoreTokens())  {
			st = new StringTokenizer(nextLine().trim());
		}
		return st.nextToken();
	}
}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long input = 0;
		long output = 0;

		input = scan.nextInt();

		System.out.println(nextLuckyYear(input));

	}

	public static long nextLuckyYear(long input) {
		long multiplier = 1;
		long result = 0;
		long copy = input;

		while (copy > 10) {
			copy /= 10;
			multiplier *= 10;
		}

		result = copy + 1;

		result *= multiplier;

		return result - input;
	}

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.*;

/**
 *
 * @author Deibu
 */
public class Luckyear {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Input: ");
        Long input = in.nextLong();
        String str = "" + input;
        String op = "";

        char c1 = 0;
        char c = 0;
        int g = 0;
        c1 = str.charAt(0);
        if (c1 != '9') {
            g = (int) c1;
            g += 1;
            op += (char) g;
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        } else {
            op += "10";
            for (int i = 1; i < str.length(); i++) {
                op += '0';
            }
        }
        System.out.println("Output");
        long s = Long.valueOf(op);
        System.out.println( s - input);

    }

}

/**
 * Created by barssaka on 15/12/21.
 */
import java.util.*;
public class Main {
    public static void main(String [] args)
    {
        Scanner scanner = new Scanner(System.in);
        int currentYear = scanner.nextInt();
        if (currentYear < 9) {
            System.out.println(1);
        }
        int base = 10;
        int t = currentYear;
        while (t / base > 9) {
            base *= 10;
        }
        System.out.println(base - (t - t / base * base));
    }
}

import java.util.Scanner;

public class LuckyYear {
	public static void main(String[] args) throws Exception {

		int in = (new Scanner(System.in)).nextInt();

		if (in < 10) {
			System.out.println(1);
		} else if (in == 10) {
			System.out.println(10);
		} else {
			int nx = in;
			int count = 0;
			while (nx > 10) {
				nx = nx / 10;
				count++;
			}
			int next = (nx + 1) * (int)Math.pow(10, count);
			//System.out.println(next);
			System.out.println(next - in);
		}

	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class main {
	static long n;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = null;
		StringTokenizer tk;
		line = in.readLine();
		if (line.length() == 1) {
			System.out.println(Integer.parseInt(line) + (1));
		} else {
			long p = 1;
			for (int i = 0; i < line.length()-1; i++) {
				p = p * 10;
			}
			long result = p *( Character.getNumericValue(line.charAt(0))+1);
			System.out.println(result - Integer.parseInt(line));
		}
	}
}

import java.util.Scanner;
public class Acode{
public static void main(String[] arsg){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int i,j=n,k=1,a=n;
while(a>10){
k=k*10;
a=j/k;
}
j=(a+1)*k;
j=j-n;
System.out.println(j);
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class LuckyYear
{

    public static void main(String[] args)
    {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int x = sc.nextInt();
        String s = x+"";
        int length = s.length();

        if( length == 1 )
        {
            out.print(1);
            out.close();
        }
        else
        {
            int a = (int)Math.pow(10, length);
            int b = a / 10 ;
            out.print( b - x%b  );
            out.close();
        }
    }

}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner() {
        try	{
            br = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer("");
        } catch (Exception e){e.printStackTrace();}
    }

    public String next() {
        if (st.hasMoreTokens())	return st.nextToken();
        try {st = new StringTokenizer(br.readLine());}
        catch (Exception e) {e.printStackTrace();}
        return st.nextToken();
    }

    public int nextInt() {return Integer.parseInt(next());}

    public long nextLong() {return Long.parseLong(next());}

    public double nextDouble() {return Double.parseDouble(next());}

    public String nextLine() {
        String line = "";
        try {line = br.readLine();}
        catch (Exception e) {e.printStackTrace();}
        return line;
    }

    public Integer[] nextIntegerArray(int n) {
        Integer[] a = new Integer[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public char[] nextCharArray() {
        return nextLine().toCharArray();
    }
}

import java.util.Scanner;
public class Acode{
public static void main(String[] arsg){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int i,j=n,k=1,a=n;
while(a>10){
a=j/k;
k=k*10;
}
j=(a+1)*k/10;
j=j-n;
System.out.println(j);
}
}

import java.util.Scanner;
public class Lucky
{
	public static void main(String args[])
	{
		int m,n,i=0,j,k,p,q,r,s,c=0,m1,m2;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		r=n;
		s=n;
		while(s!=0)
		{m2=s%10;
		 s=s/10;
		 c+=1;
		}
		int a[]=new int[c+1];
		while(n!=0)
		{m=n%10;
		 n=n/10;
		 a[i++]=m;
		}
		q=1;
		for(p=1;p<=i-1;p++)
		{q=q*10;
		}
		if(i==1)
		{System.out.println(a[i-1]+1);
		}
		else
		{k=((a[i-1]+1)*q);
		 m1=k-r;
		 System.out.println(m1);
		}
	}
}

import java.util.*;

public class CodeForces {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int k=sc.nextInt();
       long n=1;
        int h=k;
        for (;h>=1;){
            h=h/10;
            n=n*10;
        }
        if(h==1)System.out.println(k);
        n=n/10;
        int c=(int) (n-(k%n));
        System.out.println(c);
        System.out.println(n);
}
}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);

		int current1 = input.nextInt();
		int current=current1;

		char[] chars = ("" + current).toCharArray();
		int next=0;

		int characterCount=chars.length;

		//System.out.println(characterCount);

		if(characterCount==1){
		next=current+1;
		}

		else if(characterCount==2){
			next = current+ (10-current%10);
		}

		else if(characterCount==3){
			next = current+ (100-current%100);
		}

		else{

			next=current+ ( (int) Math.pow(10, characterCount-1) - next%(int) Math.pow(10, characterCount-1));
		}

		System.out.println(next-current1);

	}
}

import java.util.Scanner;
import static java.lang.Math.pow;
public class Lucky
{
	public static void main(String args[])
	{
		int m,n,i=0,j,k,p,q,r,s,c=0,m1,m2;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		r=n;
		s=n;
		while(s!=0)
		{m2=s%10;
		 s=s/10;
		 c+=1;
		}
		int a[]=new int[c+1];
		while(n!=0)
		{m=n%10;
		 n=n/10;
		 a[i++]=m;
		}
		q=1;
		for(p=1;p<=i-1;p++)
		{q=q*10;
		}
		if(i==1)
		{System.out.println(a[i-1]+1);
		}
		else
		{k=((a[i-1]+1)*q);
		 m1=k-r;
		 System.out.println(m1);
		}
	}
}

import java.util.*;

public class CodeForces {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int b=0;
       int k=1;
       if(n<10)System.out.println("1");
       else{
       for(;;){
           n++;
           b=b+k;
           if(n%2==0&&n%5==0){
               n=n/10;
               k=k*10;
           }
           else if(n/10<1)break;
       }
           System.out.println(b-k);
    }
}
}

import java.util.*;
public class LuckyYear {

	static int luckyYear(int number) {
		number = number;
		int k=0;
		if(number >= 1000000000){
			return 2;
		}
		else if(number >= 100000000){
			return 3;
		}
		while(number != 0) {
			int index = number % 10;
			if(index != 0) {
				k++;
				if(k>1){
					break;
				}
			}
			number = number /10;
		}
		if(k<=1){
			return 1;
		}
		else {
			return 0;
		}
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		for(int i=number+1;;i++){
			int p =luckyYear(i);
			if(p == 1){
				System.out.println(i-number);
				return;
			}
			else if(p == 2){
				int s = i/1000000000;
				System.out.println((s+1)*1000000000 - number);
				return;
			}
			else if(p == 3){
				int s = i/100000000;
				System.out.println((s+1)*100000000 - number);
				return;
			}
		}
	}
}

import java.io.*;

public class Lucky {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int y = Integer.parseInt(in.readLine());
    int pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      int h = 1;
      int l = 0;
      int t = 0;
      while(h * 10 < y){
        int u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
      }

    System.out.println(y-pp);
  }}
}

import java.util.*;
import java.io.*;
public class lucky
{
   public static void main(String[] args) throws IOException

   {
      Scanner in=new Scanner(System.in);
      int x=in.nextInt();
      if(x<10)
         System.out.println(""+(x+1));
      else
      {
         for(int a=1; a<10; a++)
         {
            if(x>=Math.pow(10,a)&&x<Math.pow(10,a+1))
            {
               int y=(int)(x/Math.pow(10,a))+1;
               int diff=(int)(y*Math.pow(10,a)-x);
               System.out.println(""+diff);

            }
         }

      }

   }
}

import java.io.*;
import java.util.*;

public class cf58{
	public static long isLucky(String n){
       //int mo=0;
		int c=0;
		if(n.length()==1){
			return 1;
		}
        StringBuilder str = new StringBuilder();
        for(long i=0;i<n.length();i++){
        	str.append("0");
        }

        str.append(Character.getNumericValue(n.charAt(0))+1);
        str = str.reverse();
        String s = str.toString();
        Long num = Long.parseLong(s);
        Long ans = Long.parseLong(n);

        return num-ans;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		Long n = sc.nextLong();
		System.out.println(isLucky(String.valueOf(n)));
	}
}

import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		int m=n;
		int count=0;
		int ans=1;
		if(n<10) {
			System.out.print(1);
		}

		else {
			while(m>10) {
				m=m/10;
				ans*=10;
			}
			ans*=(m%10+1);
			System.out.print(ans-n);
		}

	}

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.in;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import static java.util.Collections.list;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import javax.xml.stream.events.Characters;
import sun.security.util.Length;

/**
 *
 * @author george
 */
public class main {
public static boolean isPrime(long n) {
    if(n < 2) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    long sqrtN = (long)Math.sqrt(n)+1;
    for(long i = 6L; i <= sqrtN; i += 6) {
        if(n%(i-1) == 0 || n%(i+1) == 0) return false;
    }
    return true;
}

    private static long f(long l) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

static public class Princess{
 public int rate;public int beauty;public int intellect;public int richness;
 public Princess(int sum,int a,int b,int c){
  this.rate=sum;
  this.beauty=a;
  this.intellect=b;
  this.richness=c;
  }

        @Override
        public String toString() {
            return "Princess{" + "rate=" + rate + ", beauty=" + beauty + ", intellect=" + intellect + ", richness=" + richness + '}';
        }

 }
public static boolean contains(final int[] arr, final int key) {
    return Arrays.stream(arr).anyMatch(i -> i == key);
}
 static boolean isSubSequence(String str1, String str2, int m, int n)
    {

        if (m == 0)
            return true;
        if (n == 0)
            return false;

        if (str1.charAt(m-1) == str2.charAt(n-1))
            return isSubSequence(str1, str2, m-1, n-1);

        return isSubSequence(str1, str2, m, n-1);
    }

    static int gcdThing(int a, int b) {
    BigInteger b1 = BigInteger.valueOf(a);
    BigInteger b2 = BigInteger.valueOf(b);
    BigInteger gcd = b1.gcd(b2);
    return gcd.intValue();
}
    public static boolean checkAnagram(String str1, String str2) {
        int i=0;
        for (char c : str1.toCharArray()) {
        i = str2.indexOf(c, i) + 1;
        if (i <= 0) { return false; }
    }
    return true;

}
    /* Amusing Joke
    String a,b,c;
     a=s.next();b=s.next();c=s.next();
     if((a.length()+b.length())!=c.length()){System.out.print("here");System.out.print("NO");}
     else{
         boolean x= true;
         String agex="";
         if(checkAnagram(a, c)==false){System.out.print("here1");x=false;}
         else{
             char [] g=a.toCharArray();
             Arrays.sort(g);String ge=new String(g);a=ge;
             g=b.toCharArray();Arrays.sort(g);ge=new String(b);b=ge;
             g=c.toCharArray();Arrays.sort(g);ge=new String(c);c=ge;
            if(isSubSequence(a, c, a.length(), c.length())){
                 StringBuilder sb = new StringBuilder(c);String temp="";
                for (int i = 0; i < a.length(); i++) {
                    temp+=a.charAt(i);
                 c.replaceFirst(temp, "");temp="";

                }
            }
            else{x=false;}
            if(isSubSequence(a, c, a.length(), c.length())){
              StringBuilder sb = new StringBuilder(c);
                for (int i = 0; i < b.length(); i++) {
                  String temp="";
                    temp+=b.charAt(i);
                 c.replaceFirst(temp, "");temp="";

                }
            }
            else{x=false;}
            if(c.length()!=0){x=false;}
    }if(x==false){System.out.print("NO");}
    else{System.out.print("YES");}
    }
    */
     /*//t,l,r
      long t,l,r;t=s.nextLong();l=s.nextLong();r=s.nextLong();
      long exp=0;
      // t0·f(l) + t1·f(l + 1) + ... + tr - l·f(r).
        for (int i = 0; i <=r-l; i++) {
            exp+=((long)(Math.pow(t, i)))*f(l+i);
        }
        System.out.print(exp%(1000000007));*/
    /* 489C
        int digits=s.nextInt();int sum=s.nextInt();
        List <Integer>li=new ArrayList<Integer>();
       int digitss=sum/9;
       int rem=digits%9;
       String z=String.join("", Collections.nCopies(digitss, "9"));
       String z+=
       String digit="9";
       String x = String.join("", Collections.nCopies(digits, "9"));
       BigInteger num=BigInteger.valueOf(Long.parseLong(x));
       x=num.toString();System.out.print(x);
       li.clear();
        for (int i = 0; i < x.length(); i++) {
            li.add(x.charAt(i)-48);
        }
       Collections.sort(li);
       int zeros=0;
       //leading zeros
       String f="";
        for (int i = 0; i < li.size(); i++) {
            if(li.get(0)==0){zeros++;li.remove(0);}
            else{f=li.get(0).toString(); break;}
        }

        String y="";
        if(zeros!=0){
            li.remove(0);
            y+=String.join("", Collections.nCopies(zeros, "0"));

        }
       y+=li.stream().map(Object::toString).collect(Collectors.joining());
       System.out.print(y);System.out.print(" ");System.out.print(x);
    */

    public static List primeFactors(Long num)
    {
        List<Long>Prime=new ArrayList<Long>();
        // Print the number of 2s that divide n
        long tw=2;
        while (num%2==0)
        {
            Prime.add(tw);
            num /= 2;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (long i = 3; i <= Math.sqrt(num); i+= 2)
        {
            // While i divides n, print i and divide n
            while (num%i == 0)
            {
                Prime.add(i);
                num/= i;
            }
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (num> 2)
            Prime.add(num);
        return Prime;
    }
    public static String Winner(int [] arr)
    {
        int maxsum=-1;
        int temp=0;
        List<Integer> L=Arrays.stream(arr).boxed().collect(Collectors.toList());
        int count=0;
        String winner="First";
        while(L.isEmpty()!=true){
           if(count%2==0){winner="First";
           //take max odd interval
            for (int i = 0; i < L.size(); i++) {

            }
            }
           else{winner="Second";

           }
           count++;
        }

    return winner;
    }
    public static String changeCharInPosition(int position, char ch, String str){
    char[] charArray = str.toCharArray();
    charArray[position] = ch;
    return new String(charArray);
}
    public static void main (String []  args) throws IOException
    {
        Scanner s=new Scanner(System.in);
        String x=s.next();
        long num=Long.parseLong(x);
        if(num<10){System.out.print(1);}
        else{
        num=num/10;
        num=num*10;
        long times=(num)/(x.charAt(0)-48);
        long nextNum=x.charAt(0)-48;
        if(nextNum==9){times=times*10;
        nextNum=times;
        }
        else{
        nextNum++;
        nextNum=nextNum*times;
        }

        System.out.print(nextNum-Long.parseLong(x));

        }

    }
 }

import java.util.Scanner;

/**
 * Created by JORGE on 5/19/2017.
 */
public class Exe {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        long year = in.nextLong();
        long temp = year;
        long sum = 1;
        for(long place = 1l; temp>9; place++) {
            temp /= 10;
            sum*=10;
        }

        long goal = (year / 10 * 10) + sum;
        if(year <10)
            System.out.println("1");
        else
            System.out.println(goal - year);
    }
}

import java.util.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb=new Scanner(System.in);
		while(kb.hasNext()){
			int n=kb.nextInt();
			if(n<=9){
				System.out.println(1);
			}else{
				int i=1;
				while(i<=n){
					i=i*10;
				}
				i=i/10;
				if(n%i==0){
					System.out.println(i);
				}else{
					System.out.println(((n/i)+1)*i-n);
				}
			}

		}
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int f = sc.nextInt();
        String s = "";
        s += f;
        if(s.length() == 1){
            System.out.print(1);
            System.exit(0);
        }
        int del = 1;
        for (int i = 0; i < s.length(); i++) {
            del *= 10;
        }
        int ans = 0;
        for (int i = 0; i < del; i++) {
            if(f % (del/10) != 0){
                ans += 1;
                f += 1;
            }
            else {
                break;
            }
        }
        if(ans == 0){
            System.out.print(del/10);
        }
        else
        System.out.print(ans);
    }

    static int p = 0;

    static int bin_poisck(int a, int b, int otv) {
        int start = a;
        int end = b;
        int sr = (a + b) / 2;
        while (a + 1 < b) {
            if (sr > otv) {
                end = sr;
            } else start = sr;

        }
        return 0;

    }

    static class TimeLine implements Comparable<TimeLine> {
        int h;
        int m;

        public TimeLine() {
        }

        @Override
        public int compareTo(TimeLine o) {
            if (m != o.m) return o.m - m;
            return o.h - h;
        }
    }
}

import java.util.*;
public class LuckyYear {

	static int luckyYear(int number) {
		number = number;
		int k=0;
		if(number >= 1000000000){
			return 2;
		}
		else if(number >= 100000000){
			return 3;
		}
		while(number != 0) {
			int index = number % 10;
			if(index != 0) {
				k++;
				if(k>1){
					break;
				}
			}
			number = number /10;
		}
		if(k<=1){
			return 1;
		}
		else {
			return 0;
		}
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		for(int i=number+1;;i++){
			int p =luckyYear(i);
			if(p == 1){
				System.out.println(i-number);
				return;
			}
			else if(p == 2){
				if(i == (999999999+1)){
					System.out.println("1");
					return;
				}
				int s = i/1000000000;
				System.out.println((s+1)*1000000000 - number);
				return;
			}
			else if(p == 3){
				if(i == 1000000000){
					System.out.println("1");
					return;
				}
				int s = i/100000000;
				System.out.println(((s+1)*100000000 - number));
				return;
			}
		}
	}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){

        Scanner sc=new Scanner(System.in);
        String year=sc.next();
        int numYear=Integer.parseInt(year);
        if(numYear < 0) {
            System.out.println("Not valid Year!!!");
            return;
        }
        char[] yearArray=year.toCharArray();
        int nextLuckyYear = Integer.parseInt(""+yearArray[0]);
        nextLuckyYear++;
        if(nextLuckyYear % 10!=0) {

            while (nextLuckyYear < numYear) {
                nextLuckyYear = nextLuckyYear * 10;
            }
            System.out.println(nextLuckyYear - numYear);
        }

    }

}

import java.util.Scanner;
public class main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String year,str="";
        int year1,year2,len;
        year = input.nextLine();
        len = year.length();
        int i,result=0;
        if(len>1)
        {
            for(i=1;i<len;i++)str+=year.charAt(i);
            year1 = Integer.parseInt(str);
            year2 = Integer.parseInt(year);
            if(year2<100&&year2>=10)result = 100-year2;
            else if (year2<10)result = year2+1;
            else if(len==3)result=100-year1;
            else if(len==4)result=1000-year1;
            else if(len==5)result=10000-year1;
            else if(len==6)result=100000-year1;
            else if(len==7)result=1000000-year1;
            else if(len==8)result=10000000-year1;
            else if(len==9)result=100000000-year1;
            System.out.println(result);
        }
        else {
            year1 = Integer.parseInt(year);
            System.out.println(year1+1);
        }

    }

}

import java.util.Scanner;

public class LuckyYear {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int input = 0;
		int output = 0;

		input = scan.nextInt();

		System.out.println(nextLuckyYear(input));

	}

	public static int nextLuckyYear(int input) {
		int multiplier = 1;
		int result = 0;
		int copy = input;

		while (copy > 10) {
			copy /= 10;
			multiplier *= 10;
		}

		result = copy + 1;

		result *= multiplier;

		return result - input;
	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class CodeforcesSubmission {
	public static int getNbCh(int n){
		if (n<10)
			return 1;
		else if (n<100)
			return 2;
		else if (n<1000)
			return 3;
		else if (n<10000)
			return 4;
		else if (n<100000)
			return 5;
		else if (n<1000000)
			return 5+1;
		else if (n<10000000)
			return 5+2;
		else if (n<100000000)
			return 5+3;
		else return 9;
	}
	public static int pow(int x){
		if (x==0)
			return 1;
		else return 10*pow(x-1);
	}
	public static ArrayList<Integer> getluckies(int x){
		ArrayList<Integer> A=new ArrayList<Integer>();
		for(int i=2;i<11;i++)
			A.add(i*pow(x-1));
		return A;
	}
	public static int nearest(ArrayList<Integer> A,int n){
		int i=0;
		while ((A.get(i)-n)<=0)
			i++;
		return (A.get(i)-n);
	}
	public static void main(String[] args) {
		try{
			Scanner sc=new Scanner(System.in);
			String line1=sc.nextLine();
			int n=Integer.parseInt(line1);
			ArrayList<Integer> A=getluckies(getNbCh(n));
			System.out.println(nearest(A, n));
		}catch(Exception e){
e.printStackTrace();
//			System.out.println("err");
		}

	}
}

import java.util.Scanner;
public class Acode{
public static void main(String[] arsg){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int i,j=n,k=1,a=n;
while(a>10){
k=k*10;
a=j/k;
}
j=(a+1)*k;
j=j-n;
System.out.println(j);
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Luck_Year {
	static long powers[] = {
		1,
		10,
		100,
		1000,
		10000,
		100000,
		1000000,
		10000000,
		100000000,
		1000000000,
	};

	public static void main(String[] args) {
		System.out.println("lucky");
		FastScanner sc = new FastScanner();

		long n = sc.nextLong();

		int i = 0;
		while(n > powers[i]) i++;
		i--;
		long rem = (int) (n / powers[i]);
		rem += 1;
		rem *= powers[i];
		long res = rem - n;
		System.out.println(res);

	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}

import java.util.*;

public class demo {
    static int mod = 998244353;
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.next();
        int value = (int)(Long.parseLong(str) % mod);
        if(value < 10){
            System.out.println(1);return;
        }
        String string = "1";
        for(int i = 1 ; i < str.length() ; i++){
            string += "0";
        }
        int num = Integer.parseInt(string);
        while (true){
            if(value - num < 0){
                System.out.println(Math.abs(value - num));
                return;
            }
            else{
                num += Integer.parseInt(string);
            }
        }
    }
}

import java.util.Scanner;

/**
 *
 * @author AEmad
 */
public class Contest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
         Scanner Scanner = new Scanner( System.in );
         String String = Scanner.nextLine();
         int result = Integer.parseInt(String);
         int i;
         int z=10;
         if(String.length() == 1)
             result = result + 1;
         else
             for (int j = 0; j < String.length()-1; j++)
             {
                for(i =0; i < 100000; i++)
                {
                     int x;
                     x = result % z;
                     if(x == 0)
                     break;
                     else result++;
                }
                z=z*10;
             }
         System.out.println(result);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main(String[] args) throws IOException {
BufferedReader z=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(z.readLine());
if(n==1)
            System.out.println(1);
        else if(n < 5 && n > 1)
            System.out.println(5-n);
else if(n==5 || n==6 |n==7 || n==8 || n==9)
    System.out.println(10-n);
else{
    String s=n+"";
    int zero=s.length();
    int a=Integer.parseInt(""+s.charAt(0));
    System.out.println((int)((a+1)*Math.pow(10,zero-1))-n);
}

    }
}

import java.util.*;
import java.io.*;
public class lucky
{
   public static void main(String[] args) throws IOException

   {
      Scanner in=new Scanner(System.in);
      int x=in.nextInt();
      if(x<10)
         System.out.println(""+(x+1));
      else
      {
         for(int a=1; a<10; a++)
         {
            if(x>=Math.pow(10,a)&&x<Math.pow(10,a+1))
            {
               int y=(int)(x/Math.pow(10,a))+1;
               int diff=(int)(y*Math.pow(10,a)-x);
               System.out.println(""+diff);

            }
         }

      }

   }
}

//package kattis.Educational;

import java.io.*;
import java.util.*;

public class AE21 {

	public static void main(String[] args) throws IOException {
		IO io = new IO(System.in);
		char[] n = io.next().toCharArray();
		int offs = (int)'0';
		int sum = 0;
		int po10 = 1;
		int missing = 10;
		for (int i = n.length - 1; i > 0; i--) {
			sum += (missing - (((int)n[i]) - offs)) % 10 * po10;
			if(sum != 0) {
				missing = 9;
			}
			po10 *= 10;
		}
		io.println(sum);
		io.close();
	}

	static class IO extends PrintWriter {
		static BufferedReader r;
		static StringTokenizer t;

		public IO(InputStream i) {
			super(new BufferedOutputStream(System.out));
			r = new BufferedReader(new InputStreamReader(i));
			t = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!t.hasMoreTokens()) {
				t = new StringTokenizer(r.readLine());
			}
			return t.nextToken();
		}

		public int nextInt() throws IOException{
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
}
}

import java.io.*;
import java.util.*;

public class A {
    public static void main(String[] args) throws Exception {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int n = fs.nextInt();

        int smallest = 0;
        long add = 1;
        while(add < n) {
            smallest+= 1;
            add *= 10;
        }
        smallest--;

        long it = (long)Math.pow(10, smallest);
        while(it <= n) it += Math.pow(10, smallest);
        out.println(Math.abs(n-it));

        out.close();
    }

    static boolean lucky (int n) {
        int res = 0;
        while(n > 0) {
            if(n%10 != 0) res++;
            n/=10;
        }
        return res <= 1;
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try	{
                br = new BufferedReader(new InputStreamReader(System.in));
//                br = new BufferedReader(new FileReader("testdata.out"));
                st = new StringTokenizer("");
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens())	return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            try {line = br.readLine();}
            catch (Exception e) {e.printStackTrace();}
            return line;
        }

        public Integer[] nextIntegerArray(int n) {
            Integer[] a = new Integer[n];
            for(int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for(int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }
}

import java.util.*;
public class LuckyYear {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = scan.nextInt();
	int tmp = n;
	int count = 0;
	int zero_count = 0;
	int non_zero_count = 0;
	int prev = tmp*10;
	while(tmp!=0){
		count++;
		if(tmp%10==0){
			zero_count++;
		}else{
			non_zero_count++;
		}
		tmp = tmp/10;
		prev = prev/10;
	}
	if(count == 1){
		System.out.println(1);
	}else{
		if(non_zero_count == 1){
			System.out.println((int)Math.pow(10, count-1));
		}else{
			prev++;
			int tt = prev*(int)Math.pow(10, count-1);
			System.out.println(tt - n);
		}
	}
}
}

//*******************************************************************
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************

import java.lang.Math; // headers MUST be above the first class
import java.util.Scanner;
// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    Scanner nhapDuLieu = new Scanner(System.in);
    int n = nhapDuLieu.nextInt();
    int result = 0;
    if (n<0)
      	result = 0;
    else if (n<10)
     	result = 1;
    else if (n%10 == 1)
    	result = 9 + LuckyYear(n/10)*10;
    else if (n%10 != 1 && n%10 != 0)
    	result = 10-n%10 + LuckyYear(n/10)*10;
    else if (n%10 == 0)
    	result = 10 + LuckyYear(n/10)*10;
    else
      	result = LuckyYear(n);
	System.out.print(result);
  }

  public static int LuckyYear(int n)
  {
   	if (n/10 == 0)
    {
     	return 0;
    }
    else if (n%10 == 0){
      	return 9 + LuckyYear(n/10)*10;
    }
    else {
     	return (10 - n%10) + LuckyYear(n/10)*10;
    }
  }
}

// you can add other public classes to this editor in any order

import java.io.*;

public class Lucky2 {

  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    long y = Long.parseLong(in.readLine());
    long pp= y;
    if(y < 10) { System.out.println(1);}
    else {
      long h = 1;
      long l = 0;
      long t = 0;
      while(h * 10 <= y){
        long u = (y/h) % 10;
        y += (10-u)*h;
        h *= 10;
        if(y == h*10){break;}
      }

    System.out.println(y-pp);
  }}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Luck_Year {
	static long powers[] = {
		1,
		10,
		100,
		1000,
		10000,
		100000,
		1000000,
		10000000,
		100000000,
		1000000000,
	};

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();

		long n = sc.nextLong();

		int i = 0;
		while(n > powers[i]) i++;
		i--;
		long rem = (int) (n / powers[i]);
		rem += 1;
		rem *= powers[i];
		long res = rem - n;
		System.out.println(res);

	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}
}

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n=s.nextInt();
		int $0 = 0;
		for (;n%10==0;$0++) {
			n /= 10;
		}
		for (int k=1;true;k++) {
			int d = n+k;
			while (d%10==0) {
				d /= 10;
			}
			if (d%10 == d) {
				System.out.println((int)k*Math.pow(10, $0));
				break;
			}
		}
		s.close();
	}
}

//Do what you can't.
//MAY13D

import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class ECR21A {

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter w = new PrintWriter(System.out);
    long n=in.nextInt();
    String s=Long.toString(n);
    if (s.length()==1)
      w.println(1);
    else{
    long div1=(long)Math.pow(10,s.length()-1);
    //System.out.println("div1 is : "+div1);
    //System.out.println(Long.parseLong(s.charAt(0)+"")+1);
    if (n>=Long.toString(div1).length()){
      //div1=(long)Math.pow(10,s.length());
      div1=((Long.parseLong(s.charAt(0)+"")+1)%10)*div1;
    }

  //  System.out.println("div1 is : "+div1);
    w.println(div1-n);
  }
    w.close();
    }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int snext() {
      if (snumChars == -1)
      throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0)
        return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c))
      c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null)
      return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}