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.



Sample input:
1900


Sample output:
100

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = input()

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

Submission status: Accepted

Solution code:
#173 A
N = int(input())
print(1000 - (N % 1000)) if N % 1000 != 0 else print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

N %= 1000

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

Submission status: Accepted

Solution code:
N  = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

k = input()
k = int(k)

les = math.ceil( k / 1000)

ans = 1000 * les - k
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(i*1000 - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	n = int(input())

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

Submission status: Accepted

Solution code:
import math

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

print(1000*y-x)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

oturi=10000-n

print(oturi%1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input()) 

while N > 0:
    N -=1000

print(abs(N))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


print((10000-n)%1000)

Submission status: Accepted

Solution code:
#a問題
n=int(input())
x=int(1000)
while x<n:
    x+=1000
print(x-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
payment = int (input())

while (payment > 0):
    payment -= 1000

print(-payment)

Submission status: Accepted

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

Submission status: Accepted

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

print(1000-S)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

amari = n % 1000

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

Submission status: Accepted

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

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

print(change)

Submission status: Accepted

Solution code:
N = int(input())

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

print(n-N)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

y = x * 1000 - n

print(y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
cin = sys.stdin.readline

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

Submission status: Accepted

Solution code:
#-------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# ------------------- fast io --------------------

from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solver(N):
    for i in range(1,11):
        charge = 1000 * i - N
        if charge >= 0 and charge < 1000:
            return charge

print(solver(int(input())))

Submission status: Accepted

Solution code:
X = int(input())

i = 0
x = 0
while x<X:
  x = i*1000
  i+=1
print (x-X)

Submission status: Accepted

Solution code:
N = int(input())

syo = N//1000

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

Submission status: Accepted

Solution code:
import math

n = int(input())
tmp = math.ceil(n/1000)*1000

print(tmp - n)

Submission status: Accepted

Solution code:
n = input()
if int(n)%1000 == 0:
    print(0)
elif int(n) < 1000:
    print(1000-int(n))
else:
    print(1000-int(n[-3:]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
if money%1000==0:
  print(0)
else:
  print(1000-(money % 1000))

Submission status: Accepted

Solution code:
n = int(input())

amari = n % 1000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

m = 0
for i in range(12):
    if n > 1000*i:
        m = i
        
ans = 1000*(m+1) - n
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
money = 0
while n > money:
    money += 1000

print(money-n)

Submission status: Accepted

Solution code:
n=int(input())

for i in range(n) :
    temp=1000*(i+1)-n
    if  temp>= 0 :
        print(temp)
        break

Submission status: Accepted

Solution code:
import math
n = int(input())
i = 1
while(1):
    if 1000*i - n >= 0:
        print(1000*i - n)
        break
    else:
        i += 1

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    change = N % 1000
    if change == 0:
        print(0)
    else:
        print(1000 - change)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = -1 * N % 1000
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(10):
    if n > 1000:
        n -= 1000
    else:
        break

x = 1000 - n
print(x)

Submission status: Accepted

Solution code:
N = int( input( ) )
x = N % 1000
if x == 0 :
    print( '0' )
else :
    print( 1000 - int(x) )

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    answer = 1000 - (N % 1000)
    if answer == 1000:
        answer = 0
    return answer

def main():
    N = int(input())  # type: int
    answer = solve(N)
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#A
N=input()
if len(N) >= 4:
    N_3=N[-3:]
    ans=1000-int(N_3) if int(N_3) !=0 else 0
else:
    ans=1000-int(N)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = float(input())
if N % 1000 == 0:
    print(0)
else:
    thousand_total =  math.ceil((N + 1) / 1000) * 1000
    print (int(thousand_total - N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

amari = n%1000

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

Submission status: Accepted

Solution code:
N = int(input())
M = (N+1000-1)//1000
ans = M*1000-N
print(ans)

Submission status: Accepted

Solution code:
n = int(input())    
rem = n%1000
ans = 1000-rem
if ans == 1000: ans = 0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m= int(input())
while m> 1000 :
            m -= 1000
print(1000 - m)

Submission status: Accepted

Solution code:
money = int(input())
while money > 1000 :
    money -= 1000
print(1000 - money)

Submission status: Accepted

Solution code:
m=int(input())
for i in range(0, 11):
  if i*1000 < m <= (i+1)*1000:
    m=(i+1)*1000 - m
print(m)

Submission status: Accepted

Solution code:
import math

beer_price = int(input())
bill = math.ceil(beer_price / 1000) * 1000
change = bill - beer_price
print(change)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

i = 1
while True:
  M = 1000*i
  if M >= N:
    break
  
  i += 1
    
ans = M-N

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    print((10000 - next_int()) % 1000)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

print((1000 - a % 1000)%1000)

Submission status: Accepted

Solution code:
T=int(input())
a=T//1000
T=T-1000*a
if T==0:
  print(0)
else:
  print(1000-T)

Submission status: Accepted

Solution code:
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
input=sys.stdin.readline
##import numpy as np
#sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
##def power(x, y):
##    if(y == 0):return 1
##    temp = power(x, int(y / 2))%mo
##    if (y % 2 == 0):return (temp * temp)%mo 
##    else:
##        if(y > 0):return (x * temp * temp)%mo 
##        else:return ((temp * temp)//x )%mo
##
##for _ in range(inin()):
n=inin()
if(n%1000==0):
    print(0)
else:
    print(1000-n%1000)
    
    
    
    
    
    
        
    
    
    
    
    
    
        
        
    
    
    
    


    





##
        
    
    
    
    
    
    
        
        
    
    
    
    


    





##def msb(n):n|=n>>1;n|=n>>2;n|=n>>4;n|=n>>8;n|=n>>16;n|=n>>32;n|=n>>64;return n-(n>>1) #2 ki power
##def pref(a,n,f):             
##    pre=[0]*n
##    if(f==0):         ##from beginning
##        pre[0]=a[0]
##        for i in range(1,n):
##            pre[i]=a[i]+pre[i-1]
##    else:              ##from end
##        pre[-1]=a[-1]
##        for i in range(n-2,-1,-1):
##            pre[i]=pre[i+1]+a[i]
##    return pre
##maxint=10**24 
##def kadane(a,size): 
##    max_so_far = -maxint - 1
##    max_ending_here = 0
##       
##    for i in range(0, size): 
##        max_ending_here = max_ending_here + a[i] 
##        if (max_so_far < max_ending_here): 
##            max_so_far = max_ending_here 
##  
##        if max_ending_here < 0: 
##            max_ending_here = 0   
##    return max_so_far

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

elif N % 1000 == 0:
	print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
for i in range(1,12):
    if i * 1000 - int(N) < 0:
        continue
    else:
        print(i * 1000 - int(N))
        break

Submission status: Accepted

Solution code:
import sys
import numpy as np  # noqa

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mon = int(input())
otsuri = (10000-mon)%1000
print(otsuri)

Submission status: Accepted

Solution code:
N = int(input())

i = 0
while 1000 * i < N:
    i += 1
change = 1000 * i - N

print(change)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
if 0 <= N <= 1000:
  print(1000 - N)
elif 1001 <= N <= 2000:
  print(2000 - N)
elif 2001 <= N <= 3000:
  print(3000 - N)
elif 3001 <= N <= 4000:
  print(4000 - N)
elif 4001 <= N <= 5000:
  print(5000 - N)
elif 5001 <= N <= 6000:
  print(6000 - N)
elif 6001 <=N <= 7000:
  print(7000 - N)
elif 7001 <= N <= 8000:
  print(8000 - N)
elif 8001 <= N <= 9000:
  print(9000 - N)
else:
  print(10000 - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money1 = int(input())
if money1 % 1000 != 0:
    money2 = 1000 - (money1 % 1000)
    print(str(money2))
else:
    money2 = 0
    print(str(money2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x=None

while N>1000:
    N=N-1000
        

x=1000-N

print(x)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
while n>0:
  n-=1000
print(abs(n))

Submission status: Accepted

Solution code:
Nin = int(input())

noguchi = (Nin // 1000)
if (Nin % 1000):
    noguchi += 1

print(noguchi*1000 - Nin)

Submission status: Accepted

Solution code:
N = int(input())
ans = 1000*(1+(int)((N-1)/1000))-N
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
x = 0

while True:
    if n % 1000 == 0:
        break
    n += 1
    x += 1

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

a = N%1000
if a == 0 :
    ans = 0
else:
    ans = 1000 - a

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:



n=int(input())
res=n//1000
if res*1000==n:
    print(0)
else:
    n=n-res*1000
    print(1000-n)

Submission status: Accepted

Solution code:
N=int(input())
A=((N+1000-1)//1000)*1000-N
print(A)

Submission status: Accepted

Solution code:
N = int(input())

print(-(N%-1000))

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline

def inp():
    return(int(input()))



n = inp()

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

Submission status: Accepted

Solution code:
import math
a = int(input())
b = a /1000
B = math.ceil(b)
print(B * 1000 -a)