let input = "3000";

function main(input){
  input = input.trim();
  let simo3;
  if(input.length>3){
    simo3 = parseInt(input.substr(input.length-3));
  }else{
    simo3 = parseInt(input);
  }
  if(simo3===0){simo3=1000;}
  console.log(1000-simo3);
}//main(input);

main(require("fs").readFileSync("/dev/stdin","utf8"));
