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:
a=int(input())
if a%1000 == 0:
    print(0)
else:
    print(1000*(int(a/1000)+1)-a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
t = math.ceil(n/1000)
print(t*1000-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
while counter * 1000 < n:
    if counter * 1000 < n:
        counter += 1
if counter == 0:
    print(0)
else:
    print((counter*1000)-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n = int(input())

    #output
    while n > 0:
        n -= 1000

    print(-n)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin,stdout
for _ in range(1):
    n=int(stdin.readline())
    nm=1000*(n//1000)
    if nm<n:nm+=1000
    print(nm-n)

Submission status: Accepted

Solution code:
a = int(input())

if a % 1000 == 0:
  out = 0
else:
  out = 1000 - a % 1000

print(out)

Submission status: Accepted

Solution code:
N=int(input())
i=0
mai=1000
while i<11:
  if N <=mai:
    break
  else:
    mai+=1000
print(mai-N)

Submission status: Accepted

Solution code:
qtd = int(input())

def fun(x):
    retorno = 0
    
    if x % 1000 != 0:
        while x > 1000:
            x -= 1000
        retorno = 1000 - x

    return retorno

print(fun(qtd))

Submission status: Accepted

Solution code:
n = int(input())
 
digit = len(str(n))
 
if digit < 4:
    answer = 1000 - n
else:
    three_digits = str(n)[-3:]
    if three_digits == '000':
        answer = 0
    else:
        answer = 1000 - int(three_digits)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

    pay = (N + 1000 - 1) // 1000 * 1000
    ans = pay - N
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
for i in range(10):
  n=n-1000
  if n<=0:
    print(1000-(n+1000))
    sys.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:
n = int(input())
while n>1000:
  n%=1000
if n!=0:
  print(1000-n)
else:
  print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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((N+1000-1)//1000* 1000-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

def main():
  N = int(input())
  
  if N % 1000 == 0:
    print(0)
    return
  
  print(1000 - (N % 1000))
  
  
  
main()

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    print((100000 - ni()) % 1000)
    return

solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math
n = int(input())

ans = math.ceil(n/1000)*1000
print(ans-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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:
num = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
 
rem = money % 1000
 
oturi = 0
if rem != 0:
  oturi = 1000 - rem
 
print(oturi)

Submission status: Accepted

Solution code:
money = int(input())

rem = money % 1000

oturi = 0
if rem != 0:
  oturi = 1000 - rem

print(oturi)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
x=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
i = 0

while N > i * 1000:
    i += 1

ans = i * 1000 - N
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
  c=(n//1000+1)*1000-n
  print(c)

Submission status: Accepted

Solution code:
N = int(input())
print("{}".format(1000 - N % 1000 if N % 1000 != 0 else 0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc173
n = int(input())
while n > 1000:
    n = n -1000
print(1000 - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = (1000 - n%1000)%1000

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
pay = int(input())

print(0 if pay % 1000 == 0 and pay != 0 else 1000 - (pay % 1000))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

if 1 <= a <= 1000:
    print(1000-a)
elif 1001 <= a <= 2000:
    print(2000 - a)
elif 2001 <= a <= 3000:
    print(3000 - a)
elif 3001 <= a <= 4000:
    print(4000 - a)
elif 4001 <= a <= 5000:
    print(5000 - a)
elif 5001 <= a <= 6000:
    print(6000 - a)
elif 6001 <= a <= 7000:
    print(7000 - a)
elif 7001 <= a <= 8000:
    print(8000 - a)
elif 8001 <= a <= 9000:
    print(9000 - a)
elif 9001 <= a <= 10000:
    print(10000 - a)

Submission status: Accepted

Solution code:
N = int(input())
while N>0 :
    N -= 1000
N *= -1
print(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
x = 1000
while x <= n:
    x += 1000
    
if n % 1000 == 0:
    x -= 1000
print(x - n)

Submission status: Accepted

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

Submission status: Accepted

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

if n==0:
  print(0)
else:    
  print(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())

X = N%1000

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

Submission status: Accepted

Solution code:
N = int(open(0).read())
m = N % 1000
if m == 0:
    print(0)
else:
    print(1000 - m)

Submission status: Accepted

Solution code:

n = int(input())

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

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(0)
else:
  print(1000 - (n  % 1000))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

while 0 < N:
    N -= 1000

print(abs(N))

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:
input1 = int(input())
while input1 > 1000:
    input1 -= 1000
print(1000 - input1)

Submission status: Accepted

Solution code:

def q1():
    N = int(input())
    if N % 1000 == 0:
        print(0)
        return
    print(1000 - N % 1000)


q1()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n = int(input())
n1 = (n % 1000)
if n1 == 0:
    print(0)
else:
    print(1000-n1)

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 = int(input())
print((1000 - (n % 1000)) % 1000)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 1000*n - N
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
m = 0

while m < N:
    m += 1000
else:
    print(m-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())

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

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:
    print(1000 - n % 1000)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n = inn()
print((1000-n%1000)%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

N = I()

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

Submission status: Accepted

Solution code:
def my_input():
    i = list(map(int, input().split()))
    if len(i) == 1:
        return i[0]
    return i


n = my_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(1000 - n % 1000)
else:
  print(0)

Submission status: Accepted

Solution code:
int = int(input())
y = 1000
for i in range(1,11):
    z = y*i
    if int <= z:
        o = z - int
        break;
    else:
        pass

print(o)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
print(1000 - amari if (amari:=int(input())%1000) else 0)

Submission status: Accepted

Solution code:
n = (int)(input())
k = 0
while k < n:
    k += 1000
print(k - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

else:
   print(0)

Submission status: Accepted

Solution code:
n = int(input())
d, m = divmod(n, 1000)
if m == 0:
    print(0)
else:
    print(1000 - m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())


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

Submission status: Accepted

Solution code:
# coding: utf-8

price = int(input())
pay = 1000

while pay < price:
    pay += 1000
    #print(pay)

ans = pay - price
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import math
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
r=1000
for i in range(10000000):
  if r>=a:
    break
  r=1000*i
print(r-a)

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())
N%=1000
if N==0:
  print(0)
else:
  print(1000-N)

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(0)
else:
    print(((n // 1000) + 1) * 1000 - n)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())

if n % 1000 == 0:
    print(0)
else:
    a = 1000
    while a < n:
        a += 1000
    print(a - n)

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    u = 1000
    print(((N+u-1)//u)*u-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())

k = 0
while k * 1000 < N:
    k += 1

ans = k * 1000 - N
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

a=divmod(N,1000)

if a[1]==0:
    print(a[1])
else:
    print((a[0]+1)*1000-N)

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
v=n//1000
mod=n%1000
if mod==0:
    ans=0
else:
    ans=(v+1)*1000-n
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

N = I()
print((-N % 1000))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
amount = int(input())

x = 1000



while True:
    if amount == 0:
        x = 0
        break
    if x < amount:
        x += 1000
    else:
        break
 
print(x - amount)

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:
    print(1000 - N % 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:
ans = int(int(input()) % 1000)
if ans!=0:
    ans = 1000 - ans
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
print((1000-N%1000)%1000)

Submission status: Accepted

Solution code:
# input
N = int(input())
noguchi = [1000 * n for n in range(1, 11)]

# check
print(min([ngc - N for ngc in noguchi if (ngc - N) >= 0]))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

while n > 0:
    n =  n - 1000

ans = -1 * n

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

n %= 1000

if n == 0:
    print(0)
else:
    print("{}".format(1000-n))

Submission status: Accepted

Solution code:
import sys


N = input()
    

N_in = int(N)

if N_in>10000 or N_in<0:
    print('error')
    sys.exit()

N = N_in/1000;

N_f = float(N)

N_i = int(N)


if (N_f - N_i) == 0:
    Ans = 0
    print(Ans)

else:
    N_i = N_i + 1
    Ans = N_i*1000 - N_in
    print(Ans)

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())

n %= 1000

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

Submission status: Accepted

Solution code:
money = int(input())

if money % 1000 == 0:
  print(0)
elif money < 1000:
  print(1000 - money)
else:
  print(1000 - (money % 1000))

Submission status: Accepted

Solution code:
n = int(input())
n %= 1000
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())
n = n%1000
n = (1000 - n )%1000
print(n)

Submission status: Accepted

Solution code:
import math
n = int(input())
time = math.ceil(n / 1000)
ans = (time * 1000) - n
if ans <= 0:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc173/tasks/abc173_a

def eval(N):
    while N >= 1000:
        N -= 1000

    if N == 0:
        return 0
    else:
        return 1000 - N

# Receive input:
N = int(input())
print(eval(N))

Submission status: Accepted

Solution code:
n = int(input())

ans = n%1000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
print((x+999)//1000*1000-x)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

while n > 1000:
  n -= 1000

print(1000 - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
price = int(input())
change = 1000 - (price % 1000)
if change == 1000:
  change = 0

print(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())

sen = n // 1000
kei = n - sen*1000
if kei == 0:
    print(0)
else:
    print(1000-kei)

Submission status: Accepted

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

Submission status: Accepted

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

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:
  while n>1000:
    n-=1000
  print(1000-n)
else:
  print(0)

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    n = ri()
    r = n % 1000
    if r == 0:
        print (r)
    else:
        print (1000 - r)





mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input());

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

Submission status: Accepted

Solution code:
#
#    ------------------------------------------------
#           ____          _     Generatered using
#          / ___|        | |
#         | |    __ _  __| | ___ _ __  ______ _
#         | |   / _` |/ _` |/ _ \ '_ \|_  / _` |
#         | |__| (_| | (_| |  __/ | | |/ / (_| |
#          \____\____|\____|\___|_| |_/___\____|
#
#      GNU Affero General Public License v3.0
#    ------------------------------------------------
#    Author   : prophet
#    Created  : 2020-07-05 22:26:03.150631
#    UUID     : SX0X0QCtQizbJCbK
#    ------------------------------------------------
#
production = True

import sys, math, collections

def input(input_format = 0, multi = 0):

    if multi > 0: return [input(input_format) for i in range(multi)]
    else:
        next_line = sys.stdin.readline()[:-1]

        if input_format >= 10:
            use_list = False
            input_format = int(str(input_format)[-1])
        else: use_list = True

        if input_format == 0: formatted_input = [next_line]
        elif input_format == 1: formatted_input = list(map(int, next_line.split()))
        elif input_format == 2: formatted_input = list(map(float, next_line.split()))
        elif input_format == 3: formatted_input = list(next_line)
        elif input_format == 4: formatted_input = list(map(int, list(next_line)))
        elif input_format == 5: formatted_input = next_line.split()
        else: formatted_input = [next_line]

        return formatted_input if use_list else formatted_input[0]

def out(output_line, output_format = 0, newline = True):

    formatted_output = ""

    if output_format == 0: formatted_output = str(output_line)
    elif output_format == 1: formatted_output = " ".join(map(str, output_line))
    elif output_format == 2: formatted_output = "\n".join(map(str, output_line))

    print(formatted_output, end = "\n" if newline else "")

def log(*args):
    if not production:
        print("$$$", end = "")
        print(*args)

enu = enumerate

ter = lambda a, b, c: b if a else c

def mapl(iterable, format = 0):
    
    if format == 0: return list(map(int, iterable))
    elif format == 1: return list(map(str, iterable))
    elif format == 2: return list(map(list, iterable))
#
#   >>>>>>>>>>>>>>> START OF SOLUTION <<<<<<<<<<<<<<
#


def solve():

    n = input(11)

    b = math.ceil((n) / 1000) * 1000

    log(b)
    out(b - n)
    return


#for i in range(input(11)): solve()
solve()

#
#   >>>>>>>>>>>>>>>> END OF SOLUTION <<<<<<<<<<<<<<<
#

Submission status: Accepted

Solution code:
price = int(input())
thousand = -(-price//1000)
tsuri = 1000*thousand-price
print(tsuri)

Submission status: Accepted

Solution code:
n = int(input())

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

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())
p = -(-n//1000)
print(p*1000-n)

Submission status: Accepted

Solution code:
from math import ceil as c
n = int(input())
print(c(n/1000)*1000-n)