public class Main {

    public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    }
} public class Main {

    public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    }
} Main public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    } main {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    } int price = new java.util.Scanner(System.in).nextInt(); price new java.util.Scanner(System.in).nextInt() new java.util.Scanner(System.in).nextInt new java.util.Scanner(System.in) int pay = 0; pay 0 while (pay < price) {
            pay += 1000;
        } pay < price pay price {
            pay += 1000;
        } pay += 1000 pay 1000 System.out.println(pay - price) System.out.println System.out System System.out pay - price pay price String[] args args public class Main {

    public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    }
} public class Main {

    public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    }
} Main
public class Main {

    public static void main(String[] args) {
        int price = new java.util.Scanner(System.in).nextInt();
        int pay = 0;
        while (pay < price) {
            pay += 1000;
        }
        System.out.println(pay - price);
    }
}
