import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int s=0; s 0 if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=1000 n 1000 {
        s=1000-n;
        System.out.println(s);
    } s=1000-n s 1000-n 1000 n System.out.println(s) System.out.println System.out System System.out s if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=2000 n 2000 {
        s=2000-n;
        System.out.println(s);
    } s=2000-n s 2000-n 2000 n System.out.println(s) System.out.println System.out System System.out s if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=3000 n 3000 {
        s=3000-n;
        System.out.println(s);
    } s=3000-n s 3000-n 3000 n System.out.println(s) System.out.println System.out System System.out s if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=4000 n 4000 {
        s=4000-n;
        System.out.println(s);
    } s=4000-n s 4000-n 4000 n System.out.println(s) System.out.println System.out System System.out s if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=5000 n 5000 {
        s=5000-n;
        System.out.println(s);
    } s=5000-n s 5000-n 5000 n System.out.println(s) System.out.println System.out System System.out s if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=6000 n 6000 {
        s=6000-n;
        System.out.println(s);
    } s=6000-n s 6000-n 6000 n System.out.println(s) System.out.println System.out System System.out s if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=7000 n 7000 {
        s=7000-n;
        System.out.println(s);
    } s=7000-n s 7000-n 7000 n System.out.println(s) System.out.println System.out System System.out s if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=8000 n 8000 {
        s=8000-n;
        System.out.println(s);
    } s=8000-n s 8000-n 8000 n System.out.println(s) System.out.println System.out System System.out s if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=9000 n 9000 {
        s=9000-n;
        System.out.println(s);
    } s=9000-n s 9000-n 9000 n System.out.println(s) System.out.println System.out System System.out s if(n<=10000){
        s=10000-n;
        System.out.println(s);
    } n<=10000 n 10000 {
        s=10000-n;
        System.out.println(s);
    } s=10000-n s 10000-n 10000 n System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main{
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    }
} public class Main{
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int s=0;
    if(n<=1000){
        s=1000-n;
        System.out.println(s);
    }else if(n<=2000){
        s=2000-n;
        System.out.println(s);
    }else if(n<=3000){
        s=3000-n;
        System.out.println(s);
    }else if(n<=4000){
        s=4000-n;
        System.out.println(s);
    }else if(n<=5000){
        s=5000-n;
        System.out.println(s);
    }else if(n<=6000){
        s=6000-n;
        System.out.println(s);
    }else if(n<=7000){
        s=7000-n;
        System.out.println(s);
    }else if(n<=8000){
        s=8000-n;
        System.out.println(s);
    }else if(n<=9000){
        s=9000-n;
        System.out.println(s);
    }else if(n<=10000){
        s=10000-n;
        System.out.println(s);
    }
    
    }
}