import scala.math.floor

val pay = 1999

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