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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%1000==0:
    print(0)
else:
    i=n//1000
    print((i+1)*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:
n = int(input())
i = 0
while True:
    t = 1000*i
    if t >= n:
        p = t - n
        break
    i +=1
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input().rstrip())
num = 0

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

Submission status: Accepted

Solution code:
N = int(input())
if N>=1 and 1000>=N:
    print(1000-N)
elif N>=1001 and 2000>=N:
    print(2000-N)
elif N>=2001 and 3000>=N:
    print(3000-N)
elif N>=3001 and 4000>=N:
    print(4000-N)
elif N>=4001 and 5000>=N:
    print(5000-N)
elif N>=5001 and 6000>=N:
    print(6000-N)
elif N>=6001 and 7000>=N:
    print(7000-N)
elif N>=7001 and 8000>=N:
    print(8000-N)
elif N>=8001 and 9000>=N:
    print(9000-N)
elif N>=9001 and 10000>=N:
    print(10000-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())
for i in range(1000, 10001, 1000):
    if (ans := i - N) >= 0:
        print(ans)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Aug  7 01:24:25 2020

@author: saito
"""

# %% import phase

# %% define phase

# %% input phase
N = int(input())

# %% process phase
answer = 1000-((N-1)%1000+1)

# %%output phase
print(answer)

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

Submission status: Accepted

Solution code:
price = int(input())

change = 0
mod_change = price % 1000
if mod_change != 0:
    change = 1000 - mod_change

print(change)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

abc173a_payment()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input().strip())
if i % 1000 == 0:
    print('0')
else:
    print((i // 1000 + 1) * 1000 - i)

Submission status: Accepted

Solution code:
N = int(input())

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

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((100000000 - ni()) % 1000)
    return

solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = n // 1000
if n % 1000 != 0:
    b = a + 1
    print(f"{1000*b-n}")
else:
    print("0")

Submission status: Accepted

Solution code:
N = int(input())
# N = 1900

print((1000 - N) % 1000)

Submission status: Accepted

Solution code:
n = int(input())

a = 10000

ans = (a - n) % 1000

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=1000
i=1
while n>a:
  i=i+1
  a=a+1000
print(a-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
rounded = round(n, -3)
if rounded < n:
  rounded += 1000
print(rounded - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
price = int(input())

a = price % 1000
c = 1000 - a

if a == 0:
  print(0)
else:
  print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ct = 0
for ct in range(1,11):
    pay = 1000 * ct
    if  pay >= N:
        tsuri = pay - N
        break

print(tsuri)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(1, 12):
    if 1000*i-N>=0:
        print(1000*i-N)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

while(True) : 
    if N >= 1000 : 
        N -= 1000
    elif N == 0 : 
        print(N)
        exit()
    else : 
        print(1000-N)
        exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


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


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


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(0,10001,1000):
  if i - n >= 0:
    print(i - n)
    exit()
  else:
    continue

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1000):
  ans=n+i
  if ans%1000==0:
    print(i)
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

for i in range(10):
 if N>1000:
  N-=1000
 if N<1000:
  break

print(1000-N)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

x=1000-(n%1000)

if (n%1000)==0:
    print(0)
else :
    print('{}'.format(x))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
k = int(input())
n  =1000
t  =[]

for i in range(1,11):
	if n*i-k>=0:
		t.append(n*i-k)

print(min(t))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#A - Payment
N = int(input())
#おつり
out = 1000 - (N % 1000)
if out == 1000: out = 0
# 出力
print(out)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
if n<1000:
    print(1000-n)
else:
    str1=""
    k=n//1000
    l=len(str(n))-len(str(k))
    str1=str(k)+'0'*l
    if str1==str(n):
        print(0)
    else:
        p=int(str1)+1000
        print(p-n)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y

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

Submission status: Accepted

Solution code:
n=input()
t=len(n)
if t<4:
  print(1000-int(n))
else:
  k=int(n[0])
  if int(n)>k*10**(t-1):
    print((k+1)*1000-int(n))
  else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Date         : 2020-08-10 14:53:47
Author       : ssyze
Description  : 
'''
n = int(input())
print((n + 999)//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:
N = int(input())
if 1<= N <= 1000:
    print(1000 - N)
elif 1000 < N <= 2000:
    print(2000 - N)
elif 2000 < N <= 3000:
    print(3000 - N)
elif 3000 < N <= 4000:
    print(4000 - N)
elif 4000 < N <= 5000:
    print(5000 - N)
elif 5000 < N <= 6000:
    print(6000 - N)
elif 6000 < N <= 7000:
    print(7000 - N)
elif 7000 < N <= 8000:
    print(8000 - N)
elif 8000 < N <= 9000:
    print(9000 - N)
elif 9000 < N <= 10000:
    print(10000 - N)

Submission status: Accepted

Solution code:
#A-payment
N = int(input())
a = N % 1000

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

if N%1000 == 0:
    div=N//1000
else:
    div=(N//1000)+1

print(abs(N-(div*1000)))

Submission status: Accepted

Solution code:
N = int(input())

count = 1

while True:
    if(1000 * count >= N):
        break
    count = count + 1

print(1000 * count - N)

Submission status: Accepted

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

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())
m = 0
if n % 1000 == 0:
    m = n // 1000
else:
    m = n // 1000 + 1

print(1000*m -n)

Submission status: Accepted

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

while N * 1000 - Y <0:
    N += 1

print(N * 1000 - Y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 1000 == 0:
  P = N // 1000
else:
  P = (N // 1000) + 1

Ans = (P * 1000) - N
print(Ans)

Submission status: Accepted

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

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:
def Qa():
    n = int(input())
    c = n % 1000
    if c != 0:
        c = 1000 - c
    print(c)


if __name__ == '__main__':
    Qa()

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

while True:
  if N <= M:
    print(M-N)
    break
  else:
    M += 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())
print((1000 - (N % 1000))%1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t = int(input())
n = 1000
while n < t:
    n += 1000
print(abs(n-t))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

money = 0
if int(n)%1000 == 0:
    print(0)
elif 1000 > int(n):
    ans = 1000 - int(n)
    print(ans)
else:
    money = (int(n[:-3]) + 1)*1000
    ans = money - int(n)
    print(ans)

Submission status: Accepted

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

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((10000-n)%1000)

Submission status: Accepted

Solution code:
N = int(input())

x = N % 1000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = 1000
while a < N:
  a += 1000
print(a - N)

Submission status: Accepted

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

print((1000 - n%1000))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

y = (10000 - x) % 1000

print(y)

Submission status: Accepted

Solution code:
n = int(input())

sum = 0
while sum < n:
  sum += 1000
print(sum - n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(round_n-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    print((1000 - n%1000)%1000)
if __name__=='__main__':
    solve()

Submission status: Accepted

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

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

a = 0

while n > 1000*a:
    a += 1

print(1000*a - n)

Submission status: Accepted

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

Submission status: Accepted

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

    print((10000 - N) % 1000)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
c=0
while n > 1000*c:
  c +=1

print(1000*c-n)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！

n =I()
for i in range(10000):
    if 1000*i - n >= 0:
        print(1000*i - n)
        break

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())

print((1000-N%1000)%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 = 0
while 1000*i-n < 0:
    i = i+1
print(int(1000*i-n))

Submission status: Accepted

Solution code:
n = int(input())
for i in range(10):
  pay = 1000 * (i+1)
  change = 0
  if pay >= n:
    change = pay - n
    break
print(change)

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[i - 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


for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    #s = input()
    print(ceil(n/1000)*1000-n)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
m = 1000
while True:
  if m >= n:
      print(m - n)
      break
  else:
      m += 1000

Submission status: Accepted

Solution code:
N = int(input().strip())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input(""))
if a <= 1000:
    print(1000-a)
elif a <= 2000:
    print(2000-a)
elif a <= 3000:
    print(3000-a)
elif a <= 4000:
    print(4000-a)
elif a <= 5000:
    print(5000-a)
elif a <= 6000:
    print(6000-a)
elif a <= 7000:
    print(7000-a)
elif a <= 8000:
    print(8000-a)
elif a <= 9000:
    print(9000-a)
else:
    print(10000-a)

Submission status: Accepted

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