import scala.math.floor

object Solution1 {

  val pay = 2000 

  def main(args: Array[String]): Unit = {
    println(change(pay))
  }

  def change(pay: Int):Int = {
    var firstInt = 0
    if(pay % 1000 == 0) {
      firstInt = floor(pay / 1000).toInt
    } else {
      firstInt = floor(pay / 1000).toInt + 1
    }
  
    val money = firstInt * 1000
    money - pay
  }
}