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

public class Main {

  public static void main(String[] args) {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  }

} import java.util.*; util.* java import java.io.*; io.* java public class Main {

  public static void main(String[] args) {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  }

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

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  } main {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int bill = 1000; bill 1000 int currAmount = 0; currAmount 0 while (currAmount < N) {

          currAmount += bill;


      } currAmount < N currAmount N {

          currAmount += bill;


      } currAmount += bill currAmount bill System.out.println(currAmount-N) System.out.println System.out System System.out currAmount-N currAmount N String[] args args public class Main {

  public static void main(String[] args) {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  }

} public class Main {

  public static void main(String[] args) {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  }

} Main
import java.util.*;
import java.io.*;

public class Main {

  public static void main(String[] args) {

      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int bill = 1000;
      int currAmount = 0;
      while (currAmount < N) {

          currAmount += bill;


      }
      System.out.println(currAmount-N);
  }

}
