Problem:
 Score : 100 points    Problem Statement 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 1 1900      Sample Output 1 100  We will use two 1000 -yen bills to pay the price and receive 100 yen in change.       Sample Input 2 3000      Sample Output 2 0  We can pay the exact price.

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

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

Solution (Python):
pay = int(input())

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

Solution (Python):
n = int(input())
print((1000-n%1000)%1000)

Solution (Python):
n=int(input())
print((1000-(n%1000))%1000)

Solution (Python):
pay = int(input())

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

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

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

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

Solution (Python):
n = int(input())

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

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

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

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

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

Solution (Python):
N = int(input())

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

print(1000 * X - N)

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

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

Solution (Python):

n = int(input())

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

Solution (Python):
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)

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

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

Solution (Python):
from sys import stdin

input = stdin.readline


def solve():
    n = int(input())
    r = n % 1000
    res = 0 if r == 0 else 1000 - r
    print(res)


if __name__ == '__main__':
    solve()

Solution (Python):
import math
n = int(input())
print((1000-n%1000)%1000)

Solution (Python):
import math
n = int(input())
print( math.ceil(n/1000)*1000-n)

Solution (Python):
N = int(input())
import math as m
a = m.ceil(N / 1000)
ans = int(a*1000 - N)
print(ans)

Solution (Python):
def solve():
    N = int(input())
    if N%1000 == 0:
        print(0)
    else:
        print(1000 - (N%1000))
if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
ans = N // 1000

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

Solution (Python):
N = int(input())

if N <=1000:
    print(1000-N)

elif N <=2000:
    print(2000-N)

elif N <=3000:
    print(3000-N)

elif N <=4000:
    print(4000-N)

elif N <=5000:
    print(5000-N)

elif N <=6000:
    print(6000-N)

elif N <=7000:
    print(7000-N)

elif N <=8000:
    print(8000-N)

elif N <=9000:
    print(9000-N)

elif N <=10000:
    print(10000-N)

Solution (Python):
N = int(input())

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

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

Solution (Python):
n = int(input())
bez = 1000
while bez < n:
    bez += 1000
print(bez-n)

Solution (Python):
n = int(input())

chk = n % 1000
if chk != 0:
    print(1000-chk)
else:
    print(0)

Solution (Python):
n = int(input())

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

Solution (Python):
d = int(input())

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

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

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

Solution (Python):
n = int(input())
money = 1000
while money < n :
    money += 1000
print(money - n)

Solution (Python):
n = int(input())
for i in range(11):
  ans = i*1000
  judge = ans-n
  if judge>=0:
    break
print(judge)

Solution (Python):
A = int(input())
for i in range(11):
  a = i*1000
  t = a-A
  if t>=0:
    break
print(t)

Solution (Python):
ip = int(input())

for i in range(1,11):
    pr = 1000 * i
    if int(pr) - ip >= 0:
        print(pr - ip)
        break

Solution (Python):
def calc_change(price: int) -> int:
    return 1000 - price % 1000 if price % 1000 != 0 else 0


if __name__ == '__main__':
    print(calc_change(int(input())))

Solution (Python):
def calc_change(price: int) -> int:
    while price >= 1000:
        price = price - 1000
    return 1000 - price if not price == 0 else 0

if __name__=='__main__':
    print(calc_change(int(input())))

Solution (Python):
N = int(input())
payback = 10000-N
while payback>=1000:
    payback -= 1000
print(payback)

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
n = int(input())
div = n // 1000
if (n % 1000 == 0):
    ans = 0
else:
    ans = (div + 1) * 1000 - n

print(ans)

Solution (Python):
import math
N =int(input())

s = N / 1000

if s == 0 :
    print(0)
else :
    a = math.ceil(s) * 1000 - N
    print(int(a))

Solution (Python):
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())

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

Solution (Python):
import sys

n = int(input())

if n % 1000 == 0:
    print(0)
    sys.exit()

while n > 1000:
    n -= 1000

print(1000 - n)

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

Solution (Python):
N = int(input())

A = N % 1000

if A == 0:
    print(0)
else:
    B = 1000 - A
    print(B)

Solution (Python):
n=int(input())

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

Solution (Python):


n = int(input())

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

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

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

Solution (Python):
print((1000-int(input())%1000)%1000)

Solution (Python):
n=int(input())
print((1000-n)%1000)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    print((1000 - n % 1000) % 1000)


if __name__ == '__main__':
    solve()

Solution (Python):
a = input()
N = int(a)

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

Solution (Python):
n = int(input())

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

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

Solution (Python):


n = int(input())

while True:
    if n <= 1000:
        ans = 1000 - n
        break
    n -= 1000
    
print(ans)

Solution (Python):
N = int(input())
a,b = divmod(N,1000)
print((b,1000-b)[b != 0])

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

Solution (Python):
import math
N = int(input())
second = math.ceil(N / 1000)
print(second * 1000 - N)

Solution (Python):
N = int(input())

while True:
    N -= 1000
    if N <= 0:
        break

print(abs(N))

Solution (Python):
n = int(input())
if n % 1000 == 0:
    x = n // 1000
else:
    x = (n // 1000) + 1

print((1000 * x) - n)

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())
for i in range(10):
    ans = (i+1)*1000-N
    if ans >= 0:
        print(ans)
        exit()

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

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())
amari = N % 1000

if amari == 0:
    change = 0
else:
    change = 1000 - amari

print(change)

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

Solution (Python):
def main():

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

if __name__ == '__main__':
    print(main())

Solution (Python):
print((1000 - int(input())%1000)%1000)

Solution (Python):
n=int(input())

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

Solution (Python):
import math
n=int(input())
print(1000*math.ceil(n/1000)-n)

Solution (Python):
N = int(input())
if N < 1000:
    print(1000 - N)
elif N % 1000 == 0:
    print(0)
else:
    print(1000 - (N - 1000 * (N // 1000)))

Solution (Python):
N = int(input())

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

print(x)

Solution (Python):
n=int(input())

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

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

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

Solution (Python):
def main(N):
    surplus = N%1000
    if surplus == 0:
        return 0
    else:
        ans = 1000 - surplus
        return ans

if __name__ == '__main__':
    N = int(input())
    ans = main(N)
    print(ans)

Solution (Python):
N = int(input())
k = (N+999) // 1000
print(k*1000-N)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import ceil

def main():
    n = int(input())
    r = ceil(n / 1000) * 1000 - n
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
money=int(input())
yen_bills=1000
if yen_bills>=money:
    print(yen_bills-money)
else:
    while yen_bills<money:
        yen_bills+=1000
    print(yen_bills-money)

Solution (Python):
print(1000-(int(input())-1)%1000-1)

Solution (Python):
i = int(input())
k = 1000
while k < i:
    k += 1000
    
if k > i:
    print(k - i)
elif k == i:
    print(0)

Solution (Python):
n = int(input())
d = (n + 999) // 1000
ans = (d * 1000) - n
print(ans)

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

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

Solution (Python):
n = int(input())
mod = n%1000
print(1000-mod if mod !=0 else 0)

Solution (Python):
import math

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

Solution (Python):
N = int(input())
if N%1000==0:
    q = N//1000-1
else:
    q = N//1000
ans = 1000*(q+1)-N
print(ans)

Solution (Python):
pay = int(input())
if pay % 1000 == 0:
  print(0)
else:
  print(1000 - pay % 1000)

Solution (Python):
n = int(input())
print((1000 - n % 1000) % 1000)

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

Solution (Python):
N=int(input())
k=N%1000
if k==0:
  t=0
else:
  t=1000-k
print(t)

Solution (Python):
n = int(input())

m = n % 1000

if m == 0:
  print(0)
else:
  print(1000-m)

Solution (Python):
r = int(input()) % 1000
print((1000 - r) % 1000)

Solution (Python):

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

Solution (Python):
n = int(input())

a = 0

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

Solution (Python):
n = int(input())
for i in range(1000,10001,1000):
    if(i>=n):
        print(i-n)
        break

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

print(ans)

Solution (Python):
import math

N = int(input())
A = math.ceil(N/1000)
B = A * 1000

print(B-N)

Solution (Python):
n = int(input())
y = 1000 - (n % 1000)
if y == 1000:
    y = 0
print(y)

Solution (Python):
import math
N = int(input())
x = math.ceil(N/1000)
print(x*1000-N)

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

Solution (Python):
N = int(input())
a = N % 1000
if a == 0:
    print(0)
else:
    b = int(N / 1000)
    print((b + 1) * 1000 - N)

Solution (Python):
def main():
    from sys import stdin

    readline = stdin.readline

    N = int(readline().rstrip())
    
    result = ( 10000 - N )%1000

    print(result)

main()

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

Solution (Python):
N = int(input())

bill = 1000

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

Solution (Python):
n = int(input())

b = (n+(1000-1))//1000

print(b*1000-n)

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
N=input()
n=int(N)
k=int(n%1000)
if k==0:
    print(0)
else:
    print(1000-k)

Solution (Python):
N = int(input())
tmp = 1000
while N > tmp:
    tmp += 1000

print(tmp - N)

Solution (Python):
n = int(input())
r = n % 1000

if r == 0:
    print(0)
else:
    print(1000 - r)

Solution (Python):
import math
n = int(input())
if n%1000 == 0:
  print(0)
else:
  print(1000 - n%1000)

Solution (Python):
N = int(input())

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

Solution (Python):
def resolve():
    N = int(input())
    ans = N % 1000
    if ans == 0:
        print(0)
    else:
        print(1000 - ans)
resolve()

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())

for i in range(10):
  pay = (i + 1) * 1000
  if(pay >= N):
    break

if(pay < N):
  print("たりません")
else:
	print(pay - N)

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

Solution (Python):
payment = int(input())

count = 1
while True:
    if count * 1000 >= payment:
        print(count * 1000 - payment)
        break
    count += 1

Solution (Python):
N= (int(input()))%1000

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

Solution (Python):
print(-int(input())%1000)

Solution (Python):
n = int(input())
t = 1000
while n > t:
    t += 1000
print(t - n)

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

Solution (Python):
import math

N = int(input())

print(math.ceil(N / 1000) * 1000 - N)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())

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

print(num * 1000 - N)

Solution (Python):
N = int(input())

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

Solution (Python):
N=int(input())
if(N%1000==0):
  print(0)
else:
  print(-(-N//1000)*1000-N)

Solution (Python):
a=input()

if len(a)==4 or len(a)==5:
  b=a[1:]
  c=1000-int(b)
  if c==1000 :
    print('0')
  else:
    print(c)
  
else:
  print(1000-int(a))

Solution (Python):
N = int(input())
num = N// 1000
mode = N % 1000
if mode == 0:
    print(0)
else:
    print((num + 1) * 1000 - N)

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

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

Solution (Python):
import itertools

n = int(input())

for i in itertools.count():
    if (i * 1000) >= n:
        break

print(i * 1000 - n)

Solution (Python):
N=int(input())
print(1000*(N%1000!=0)-N%1000)

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

Solution (Python):
print(-int(input())%1000)

Solution (Python):
n=int(input())
print((n+999)//1000*1000-n)

Solution (Python):
n=int(input())
ans=1000*((n+999)//1000)-n
print(ans)

Solution (Python):
N=int(input())
C=10000-N
Ch=C%1000
print(Ch)

Solution (Python):
n = int(input())
n = 10000 - n
n %= 1000
print(n)

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

Solution (Python):
import math

N = int(input())

print(math.ceil(N / 1000) * 1000 - N)

Solution (Python):
num = int(input())
a = num%1000
if(a != 0):
    print(1000-a)
else:
    print(0)

Solution (Python):
a = int(input())
num = a //1000
b = num*1000 - a
if b < 0:
    c = (num+1)*1000-a
    print(c) 
else:
    print(b)

Solution (Python):
n = int(input())
print((1000-n)%1000)

Solution (Python):
n = int(input())

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

Solution (Python):
def resolve():
    N = int(input())
    print(1000 * ((1000 + (N-1)) // 1000) - N)
resolve()

Solution (Python):
n = int(input())

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

Solution (Python):
def main():
    n = int(input())

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    if n%1000>0:
        print(1000-n%1000)
    else:
        print(0)

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    if n%1000>0:
        print(1000-n%1000)
    else:
        print(0)

if __name__=='__main__':
    main()

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

Solution (Python):
N = int(input())

s = N // 1000
t = N % 1000

pay = 0
dif = 0

if t != 0:
  pay = 1000 * (s + 1)
  dif = pay - N
  print(dif)
  
else:
  print(0)

Solution (Python):
print((-int(input()))%1000)

Solution (Python):
N = int(input())

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

Solution (Python):
N = input()

result = ((1000-int(N) % 1000)%1000)
print(result)

Solution (Python):
n = input()
if len(n) < 3:
  print(1000 - int(n))
else:
  hasuu = n[len(n) - 3:]
  if hasuu == '000':
    print('0')
  else:
    print(1000-int(hasuu))

Solution (Python):

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

Solution (Python):


N = int(input().split()[0])
ans = int(str(10000 - N)[-min(3, len(str(10000 - N))) :])
print(ans)

Solution (Python):

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

Solution (Python):
def main():
    M = int(input())
    n, r = M // 1000, M % 1000

    if r == 0:
        print(0)
        return

    print((n+1)*1000-M)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
x = n % 1000

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

Solution (Python):
N = int(input())
print(f"{-N % 1000}")

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

Solution (Python):
x = int(input())
out = 1000 - x % 1000 if x % 1000 != 0 else 0
print(out)

Solution (Python):
n = int(input())

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

Solution (Python):

def main():
    N = int(input())
    x = 1 + ((N-1) // 1000)
    print(1000*x -N)

if __name__ == "__main__":
    main()

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

Solution (Python):
n = int(input())

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

Solution (Python):
change = int(input()) % 1000
print(1000-change if change else change)

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

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

Solution (Python):
N = int(input())

N %= 1000

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

Solution (Python):
N  = int(input())

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

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

Solution (Python):
n = int(input())
extra = n % 1000

if extra == 0:
  print(0)
else:
  print(1000 - extra)

Solution (Python):
import math

k = input()
k = int(k)

les = math.ceil( k / 1000)

ans = 1000 * les - k
print(ans)

Solution (Python):
N = int(input())

print(-(-N//1000)*1000 - N)

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

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

Solution (Python):
N = int(input())

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

Solution (Python):
import math
N=int(input())

print(math.ceil(N/1000)*1000-N)

Solution (Python):
n = int(input())
i = 1
while i * 1000 < n:
    i += 1

print(i*1000 - n)

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    mod = N % 1000
    q = N // 1000
    if mod != 0:
        q += 1
    ans = 1000 * q - N
    print(ans)

Solution (Python):
print((1000-int(input())%1000)%1000)

Solution (Python):
n = int(input())

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

Solution (Python):
x = int(input())
print((1000 - x % 1000) % 1000)

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

Solution (Python):
n = int(input())
num = int(n / 1000)

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

Solution (Python):
price = int(input())
amari = price % 1000
if amari == 0:
  print(0)
else:
  print(1000 - amari)

Solution (Python):
n = int(input())
for i in range(11):
  if 1000*i >= n:
    print(1000*i - n)
    exit()

Solution (Python):
N = int(input())

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

Solution (Python):
if __name__ == '__main__':

	n = int(input())

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

Solution (Python):
import math

x = int(input())
y = math.ceil(x/1000)

print(1000*y-x)

Solution (Python):
N = int(input())

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

Solution (Python):
n = int(input())

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

Solution (Python):
n = int(input())

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

Solution (Python):
N=int(input())
print(-N%1000)

Solution (Python):
n = int(input())

from math import ceil
change = ceil(n/1000)*1000 - n
print(change)

Solution (Python):
n=int(input())

oturi=10000-n

print(oturi%1000)

Solution (Python):
S = int(input())
if S % 1000 == 0:
    W = 0
else:
    W = 1000-(S % 1000)
print(W)
190

Solution (Python):
n = int(input())
print((10000-n) % 1000)

Solution (Python):
print((10000-int(input()))%1000)

Solution (Python):
import sys
input = sys.stdin.readline

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

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

Solution (Python):
n = int(input())
for i in range(1,11):
    if 1000 * i >= n:
        print(1000*i-n)
        break

Solution (Python):
print((1000-int(input())%1000)%1000)

Solution (Python):
import math
n = int(input())
print((math.floor((n - 1) / 1000) + 1) * 1000 - n)

Solution (Python):
N = int(input()) 

while N > 0:
    N -=1000

print(abs(N))

Solution (Python):
n = int(input())
if n % 1000 == 0:
  if n > 1000:
  	print(0)
  else:
    print(1000 - n)
else:
  k = n % 1000
  print(1000 - k)

Solution (Python):
n = int(input())
result = 1000 - n % 1000

if result == 1000:
    print(0)
else:
    print(result)

Solution (Python):
n=int(input())
amari=n%1000
if n%1000==0:
    print("0")
else:
    print(1000-amari)

Solution (Python):
n=int(input())
amari=n%1000
if n%1000==0:
    print("0")
else:
    print(1000-amari)

Solution (Python):
n=int(input())


print((10000-n)%1000)

Solution (Python):

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

Solution (Python):
import sys; input = sys.stdin.readline
n = int(input())
if n%1000 == 0: print(0)
else: print(1000 - n%1000)

Solution (Python):
import math
N = int(input())
count = math.ceil(N/1000)
print(  1000*count - N )

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

mod = N % 1000
if mod==0:
    exchange = 0
else:
    exchange = 1000-mod

print(exchange)

Solution (Python):
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

n = I()

print(1000 * C(n / 1000) - n)

Solution (Python):
N=int(input())
if N%1000==0:
    Q=N//1000
else:
    Q=N//1000+1
W=Q*1000-N
print(W)

Solution (Python):
x = int(input())
print((1000-x%1000)%1000)

Solution (Python):
N = int(input())

if N % 1000 == 0:
  print("0")
elif N < 1000:
  print(1000-N)
else:
  n = list(str(N))
  print(1000*(1+int(n[0]))-N)

Solution (Python):
a=input()
b=int(a[-3:])
if b==0:
  ans=0
else:
  ans=1000-b
print(ans)

Solution (Python):
n = int(input())
c = 0

if n % 1000 != 0:
    c = 1000 - n % 1000

print(c)

Solution (Python):
N = int(input())

print((1000 - N % 1000)%1000)

Solution (Python):
print(-int(input())%1000)

Solution (Python):
payment = int (input())

while (payment > 0):
    payment -= 1000

print(-payment)

Solution (Python):
n=int(input())
if n%1000!=0:
  print(abs(int(n%1000)-1000))
else:
  print(n%1000)

Solution (Python):
N=int(input())
if N%1000!=0:
  S=N%1000
else:
  S=1000

print(1000-S)

Solution (Python):
n = int(input())
print(-(-n//1000)*1000 -n)

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

Solution (Python):
N = int(input())
if N<1000:
    print(1000-N)
elif N%1000 == 0:
    print(0)
elif N%1000 !=0:
    print(1000-N%1000)

Solution (Python):
N = int(input())

r = N
while  r >= 1000:
	r = r-1000

if r == 0:
	print(0)
else:
	print(1000-r)

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

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

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

Solution (Python):
n = int(input())

amari = n % 1000

if amari == 0:
    print(0)
else:
    print(1000 - amari)

Solution (Python):
import math
N = int(input())

change = (math.ceil(N/1000))*1000-N

print(change)

Solution (Python):
N = int(input())

n = -(-N//1000)*1000

print(n-N)

Solution (Python):
N=int((input()))

if N%1000==0:
    print(0)
    
else:
  N=str(N)
  a = len(N)
  if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
  elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
  else :
        x = int(N[a-1])
        print(1000-x)

Solution (Python):
N = int(input())
ans = 0
if N % 1000 == 0:
    print(ans)
    
else:
    a = N // 1000
    ans = (a+1)*1000 - N
    print(ans)

Solution (Python):
import math

N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)

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

Solution (Python):
n = int(input())
n %= 1000

if n == 0:
    print(0)
else:
    print(1000 - n)

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

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

Solution (Python):
a = int(input())
i = 0
while 1000 * i < a:
    i += 1
print(1000 * i - a)

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

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

Solution (Python):
n = int(input())

if n % 1000 == 0:
  x = n // 1000
else:
  x = n // 1000 + 1

y = x * 1000 - n

print(y)

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

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

Solution (Python):
N = int(input().rstrip())
m = N % 1000
r = m
if m != 0: 
    r = 1000 - m

print(r)

Solution (Python):
n = int(input())
print(- n % 1000)

Solution (Python):
s = int(input())
print((1000-s%1000)%1000)

Solution (Python):
n = int(input())

import math
if n % 1000 == 0:
    print(0)
else:
    print(1000 - (n % 1000))

Solution (Python):
import sys
cin = sys.stdin.readline

n = int(cin())
n1000 = n % 1000
print(n1000 if n1000 == 0 else 1000 - n1000)