We will buy a product for N yen (the currency of Japan) at a shop.
If we use only 1000-yen bills to pay the price, how much change will we receive?
Assume we use the minimum number of bills required.

-----Constraints-----
 - 1 \leq N \leq 10000
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
Print the amount of change as an integer.

-----Sample Input-----
1900

-----Sample Output-----
100

We will use two 1000-yen bills to pay the price and receive 100 yen in change.

Difficulty: introductory

Starter code:

Solutions:
n = int(input())
print(((1000 - n % 1000) % 1000))


import math
N = int(input())
print(1000*math.ceil(N/1000)-N)

X = int(input())
if X % 1000 == 0:
    print(0)
else:
    print(1000 - (X % 1000))

from math import ceil

N = int(input())

x = ceil(N / 1000)
print(x*1000 - N)

N = int(input())
import math
print(math.ceil(N/1000)*1000-N)

n = int(input())

while n>1000:
  n -= 1000
  
print(1000-n)

n = int(input())
print('0' if n%1000==0 else str(1000-n%1000))

n = int(input())
print(((1000 - n % 1000) % 1000))


n=int(input())
a=1000-n%1000
if a==1000:
  print(0)
else:
  print(a)

N = int(input())

for i in range(11):
    if(1000 * i >= N):
        print((1000 * i - N))
        break


import math

def main():
    n = int(input())
    print(math.ceil(n/1000)*1000 - n)
    
    
    
def __starting_point():
    main()
__starting_point()

n=int(input())
if n%1000==0:
    print(0)
else:
    print((n//1000+1)*1000-n)

n = int(input())

print(1000*((n+999)//1000)-n)

price=int(input())
number=int(price/1000) + 1

if price%1000==0:
	print(0)
else:
	change=number*1000-price
	print(change)

import math
n = int(input())
m = math.ceil(n / 1000) 
print(1000*m - n)
1000

m = int(input())

if 1000 < m :
    if m % 1000 == 0: print(0)
    else:
        mai = m // 1000
        ryo = (mai + 1) * 1000
        print(ryo - m)
   
else: print(1000-m)

N = int(input())

if N%1000==0:
    print((0))
else:
    print(((N//1000+1)*1000-N))



n = int(input())

if n < 1000:
  print((1000 - n))
else:
  if n % 1000 == 0:
    print((0))
  else:
    x = n // 1000
    print((1000 * (x + 1) - n))


n = int(input())
print(1000-(n-n//1000*1000) if n%1000 != 0 else 0)

N = int(input())
a = int((N+1000-1)/1000)*1000
print(a-N)

n=int(input())
print((1000-(n%1000))%1000)

N = int(input())
if N%1000 == 0:
  print(0)
else:
  print(1000-(N%1000))

n = int(input())
a = n // 1000
if n % 1000 == 0:
  print((0))
else:
  print((1000 * (a + 1) - n))


N = int(input())
if N % 1000 == 0:
   print("0")
elif N >= 1 and N < 1000:
   print(1000 - (N % 1000))
elif N >= 1000 and N <= 10000:
   print(1000 - (N % 1000))

x = int(input())

print(0 if x%1000==0 else 1000-x%1000)

print(-int(input())%1000)

n = int(input())
r = n % 1000
if r == 0:
    print("0")
else:
    otu = 1000 - r
    print(otu)

N = int(input())
for i in range(11):
  if 1000*i - N >= 0:
    print(1000*i - N)
    break

print((1000-int(input())%1000)%1000)

n = int(input())
k = n
while k > 0:
    k -= 1000
print(-k)

a = int(input())
sa = str(a)
index1= int(sa[0])*1000+1000
if a%1000 ==0:
    print(0)
elif a <1000:
    print(1000 - a)
elif a>1000:
    a= index1 -a
    print(a)

N = int(input())
 
if N % 1000 == 0:
    print((0))
elif N < 1000:
    print((1000-N))
else:
    c = 1 + int(str(N)[0:len(str(N))-3])
    print((1000*c - N))


n = int(input())
ans = 1000 - n % 1000
if ans == 1000:
    print(0)
else:
    print(ans)

import math
N = int(input())
X = math.ceil(N/1000)
print((X*1000)-N)

rs = int(input())%1000
print(1000-rs if rs else 0)

N = int(input())
if N%1000==0:
    print((0))
else:
    S = N // 1000
    print(((S+1)*1000-N))


N = int(input())
ans = 1000 - (N % 1000)
if ans == 1000:
    ans = 0
print(ans)

n=int(input())
i=1000
while i<n:
    i+=1000
print(i-n)

N = int(input())
if N % 1000 == 0:
  print(0)
else:
  while N > 1000:
    N -= 1000
  print(1000-N)

n = int(input())
roop = True
x = 0
while roop:
    x += 1
    if 1000 * x >= n:
        roop = False
print((1000 * x) - n)

n=int(input())
print (0 if not n%1000 else 1000-n%1000)

print((1000-int(input())%1000)%1000)

from math import ceil
buy = int(input())
pay = ceil(buy / 1000) * 1000
oturi = pay - buy
print(oturi)

price = int(input())

for n in range (1,10000):
    payment = n*1000
    if payment>=price:
        print(payment-price)
        return

n = int(input())

if n%1000 == 0:
    ans = 0
else:
    ans = (n//1000+1)*1000 - n

print(ans)


y=1000
print((y-int(input())%y)%y)

n = int(input())
if n % 1000 == 0:
    print(0)
else:
    print(1000-n%1000)

x=int(input())
x=x%1000
if x==0:
  x=1000
print(1000-x)

N = int(input())
note = 1000

reminder = str(N/note)[-1]
if int(reminder) == 0:
    result = 0
else:
    reminder = (N//note)+1
    result = (int(reminder * note)) - N
    
print(result)

n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)

print((10000-int(input()))%1000)

s = int(input())

for i in range(1,11):
    if s <= i * 1000:
        ans = i * 1000 - s
        print(ans)
        break


n = int(input())
if n % 1000:
    print((1000 - n % 1000))
else:
    print((0))


N=int(input())
N=1000-N
while N<0:
  N+=1000
print(N)

n = int(input())

a = n % 1000
if(a == 0):
    a = 0

else:
    a = 1000 - a

print(a)

import math
N = int(input())
print(math.ceil(N / 1000) * 1000 - N)

n = int(input())

print(((1000 - n % 1000) % 1000 ))


print((-int(input()))%1000)

N = input()
sen_yen_sheet = -(-int(N) // 1000)
money = 1000 * sen_yen_sheet

change = money - int(N)

print(change)

n = input()
if int(n[-3:]) == 000:
    print(0)
else:
    print(1000-int(n[-3:]))

import math 
N = int(input())
print(math.ceil(N/1000)*1000-N)

N = int(input())
if N % 1000 == 0:
    print('0')
elif N % 1000 != 0:
 N2 = N // 1000 * 1000 + 1000
 print(N2 - N)

n = int(input())
ans = -n%1000
print(ans)

N = input()

shimo3keta = int(N[-3:])

if shimo3keta > 0:
    print(1000 - shimo3keta)
else:
    print(0)

s = int(input())
m = 1000
print( (m * int((s + (m - 1))/m) )  - s )

n = int(input())

if n % 1000 == 0:
    change = 0
else:
    change = (int(n / 1000) + 1) * 1000 - n

print(change)


num = int(input())
x = ""
cnt = 1000
while x != "pass":
    if cnt >= num:
        x = "pass"
    else:
        cnt += 1000
print(cnt - num)

n = int(input())

a = n%1000
if a == 0:
    print(a)
else:
    aa = 1000 - a
    print(aa)

N = int(input())
print((0 if N%1000==0 else 1000-N%1000))


N = int(input())
ans = (N % 1000)
if ans != 0:
    ans = 1000 - ans
print(ans)

X = int(input())

if X%1000==0:
    print(0)
else:
    print(1000-(X%1000))

pay = int(input())

while(pay >0):
    pay -= 1000
otu = abs(pay)
print(otu)

import math

N = int(input())
print(math.ceil(N / 1000) * 1000 - N)

import math
N = int(input())
sen = math.ceil(N/1000) * 1000
print(sen - N)

def main():
    N = int(input())

    if N % 1000 == 0:
        print((0))
    else:
        print(((N//1000 + 1)*1000 - N))
main()


import math
n = int(input())
x = math.ceil(n / 1000)
ans = (x * 1000) - n
print(ans)


N = int(input())

if N % 1000 == 0:
    print((0))
else:
    n = str(N)
    print((1000 - int(n[-3:])))


N = int(input())

X = (N - 1)// 1000 + 1

print((1000 * X - N))


N = input()
N = int(N)

for X in range(0,11):
    a = N-1000*X
    
    if a <= 0:
        break;
C=1000*(X)-N
print(C)

N = int(input())
a = 0

while a < N:
    a += 1000
    
print(a - N)

N = int(input())

if N % 1000 == 0:
    print(0)
else:
    print(1000 - N % 1000)

import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n = int(input())

tmp = 0
res = 0

res = 1000 * ceil(n / 1000) - n

print(res)


n = int(input())

x = 0

while True:
  x += 1
  if n <= x*1000:
    print(x*1000-n)
    return

n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)

N=int(input())
if N%1000==0:
    print(0)
else:
    print(1000-N%1000)

n = int(input())
 
x = 0
 
while True:
  x += 1
  if n <= x * 1000:
    print(x * 1000 - n)
    return


n = int(input())

if n % 1000 == 0:
    print(0)
else:
    print(1000 * ((n // 1000) + 1) - n)

N = int(input())
paid = (N + 999) // 1000
change = 1000 * paid - N
print(change)


n=int(input())
if n%1000==0:
    print(0)
else:
    print((n//1000+1)*1000-n)

n=int(input())
p=0
while p<n:
    p+=1000
print(format(p-n))

n = int(input())
 
x = 0
 
while True:
  x += 1
  if n <= x * 1000:
    print(x * 1000 - n)
    return

N = int(input())
ans = 1000 - N % 1000
if ans == 1000:
    print(0)
else:
    print(ans)

n = int(input())
ans = (1000 - (n % 1000)) % 1000
print(ans)


N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000 - (N % 1000))

import math
n = int(input())
num = int(math.ceil(float(n)/1000))
print((num*1000-n))


pay = int(input())

if pay % 1000 == 0:
  print(0)
else:
  print((pay // 1000 + 1) * 1000 - pay)

i = int(input())
while i>0:
    i -= 1000
print(abs(i))

n = input()
print((1000 - int(n[-3:]) if int(n) % 1000 != 0 else 0))


n=int(input())
change=1000-n%1000
if change==1000:
  print(0)
else:
  print(change)

n = int(input())
print(1000 - (n % 1000) if n % 1000 != 0 else 0)