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:
n = int(input())
print(1000 - n % 1000 if n%1000 != 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:
N=int(input())
cnt = (N+999)//1000
ans = cnt * 1000 - N
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

# A - Payment /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点
# 問題文
# お店で N円の商品を買います。
# 1000円札のみを使って支払いを行う時、お釣りはいくらになりますか？
# ただし、必要最小限の枚数の 1000円札で支払いを行うものとします。
# 制約
#     1≤N≤10000
# N は整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N

# 出力
# お釣りの金額を整数で出力せよ。

# 入力例 1
# 1900

# 出力例 1
# 100

# 1000円札 2 枚で支払いを行い、お釣りは 100円になります。

# 入力例 2
# 3000

# 出力例 2
# 0

# ちょうど支払えます。

# 解答
def abc173_a(lines):
    N = int(lines[0])
    amari = N % 1000
    if amari == 0:
        answer = 0
    else:
        answer = 1000 - amari
    return [answer]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['1900']
        lines_export = [100]
    elif pattern == 2:
        lines_input = ['3000']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = abc173_a(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#practice
N=int(input())
if N>=0 and N<=1000:
	i=1
if N>1000 and N<=2000:
	i=2
if N>2000 and N<=3000:
	i=3
if N>3000 and N<=4000:
	i=4
if N>4000 and N<=5000:
	i=5
if N>5000 and N<=6000:
	i=6
if N>6000 and N<=7000:
	i=7
if N>7000 and N<=8000:
	i=8
if N>8000 and N<=9000:
	i=9
if N>9000 and N<=10000:
	i=10
x=1000*i-N
print(x)

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

Submission status: Accepted

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000 - N % 1000)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    zan = N % 1000

    print(1000 - zan if (zan > 0) else 0)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

num = math.ceil(N / 1000)

oturi = num * 1000 - N

print(oturi)

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())
if N % 1000 != 0:
    print(((N//1000 + 1) * 1000) - N)
else:
    print('0')

Submission status: Accepted

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

ans = money - N
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n>0:
    n=n-1000

print(abs(n))

Submission status: Accepted

Solution code:
import sys
import math
N = int(input())
if not ( 1 <= N <= 10000 ): sys.exit()

ans = str(10000 - N)
print(int(ans[-3:]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
# b, c =
# a = int(input())
n = str(input())
# target_list = [int(i) for i in input().split()]

# 判定
if int(n) % 1000 == 0:
    print(0)
else:
    print(1000 - int(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:
def main():
    N = int(input())
    rem = N % 1000
    ans = rem if rem == 0 else 1000 - rem
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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



# 出力
print("{}".format((1000-(a%1000))%1000))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input(""))
if N % 1000 == 0:
    N1 = N // 1000
else:
    N1 = N // 1000 + 1

print(N1 * 1000 - N)

Submission status: Accepted

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

def main():

    N = int(input())

    if N % 1000 == 0:
        ans = 0

    else:
        ans = 1000 - (N % 1000)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

amari = N % 1000

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

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(-(-n // 10**3)* 10**3 - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#a, b = map(int, input().split())
#l = list(map(int, input().split()))
#s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#/usr/bin/python

def solve():
    price = int(input())
    mod = price % 1000
    return (1000 - mod) % 1000

print(solve())

Submission status: Accepted

Solution code:
n = int(input())

sen = -(-n // 1000)
ans = sen * 1000 - n

print(ans)

Submission status: Accepted

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

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
import sys
from collections import Counter
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    while n > 0:
        n -= 1000
    print(-n)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
m = len(N)
if m > 3:
    N = N[-3:]

if N == '000':
    print(0)
    exit()
print(1000 - int(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())
m = n % 1000
if m == 0:
    print(0)
else:
    print(1000 * (int(n / 1000) + 1) - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
rl = sys.stdin.buffer.readline

N = int(rl())

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

print(-N % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

hyaku = N % 1000
# print(hyaku)

ans = None
if hyaku == 0:
    ans = 0
else:
    ans = 1000 - hyaku

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(20):
    t = 1000 * i
    otsuri = t - N
    # print(i, t, otsuri)
    if otsuri >= 0:
        break

print(otsuri)

Submission status: Accepted

Solution code:
from math import ceil

a = int(input())
print((ceil(a / 1000) * 1000) -  a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
price=int(input())

ans=price%1000

if ans!=0:
    ans=1000-ans

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= input()
x=int(N)
if x<1000:
    print(1000-x)
if x==1000:
    print(0)
if x > 1000:   
    while True: #0 1 2 4 5が出力される
	    x -= 1000
	    if x < 1001:
		    break      
    print(1000-x)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
import itertools
import math
import sys

INF = float('inf')


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


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))


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:
def solve():
    N = int(input())
    print((1000-N%1000)%1000)

if __name__ == "__main__":
    solve()

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())
satu = (n // 1000) + 1
print(1000 * satu - n if n % 1000 != 0 else 0)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

sa = 10000 - N
ans = sa % 1000

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

cash = 1000

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

Submission status: Accepted

Solution code:
n=int(input())

if n%1000 == 0:
  ans=n%1000

else:
  num=n//1000+1
  ans=num*1000-n

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
int_num = int(input())
n_surplus = int_num % 1000

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

amount = int(input())
payment = math.ceil(amount/1000)*1000

print(payment - amount)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

#print the result
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())
if n % 1000 == 0:
    print(0)
else:
    print((n // 1000 + 1) * 1000 - n)

Submission status: Accepted

Solution code:
S = 1e3

def main():
    n = int(input())
    r = n % S
    if r == 0:
        return int(r)
    else:
        return int(S - r)

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

Submission status: Accepted

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

total=math.ceil(N/1000)*1000

print(total-N)

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())
otsuri = (1000 - N%1000)%1000
print(otsuri)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input().rstrip())

print((1000-n)%1000)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())

num = n // 1000

if n % 1000 == 0:
    pass
else:
    num += 1

ans = 1000 * num - n

print(ans)

Submission status: Accepted

Solution code:
input_number = int(input())
number = 1000

n = input_number % number
if n > 0:
  print(number - n)
else:
  print(n)

Submission status: Accepted

Solution code:
N=int(input())

while N>1000:
    N=N-1000

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

Submission status: Accepted

Solution code:
s =int(input())

a= s%1000

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

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

Submission status: Accepted

Solution code:
N=int(input())

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

else:
	N1=N%1000

	print(1000-N1)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cash = int(input())

paid = (1000 - cash % 1000) % 1000
print(paid)

Submission status: Accepted

Solution code:
cash = int(input())
 
n = 0
paid = 0
while paid < cash:
  paid = 1000 * n 
  n += 1
 
print(paid - cash)

Submission status: Accepted

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

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())
if n%1000==0:
    print(0)
else:
    x=math.ceil(n/1000)
    ans=int(x*1000)-n
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n > 1000:
    n -= 1000

print(1000 - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [1000,2000,3000,4000,5000,6000,7000,8000,9000,10000]
for i in l:
    if n <= i:
        r = i
        break
result = r - n
print(result)

Submission status: Accepted

Solution code:
def a173(n):

    return 1000-int(n[-3:]) if int(n[-3:]) != 0 else 0

def main():
    n = str(input())
    print(a173(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())
for i in range(0, n//1000+1, 1):
    n -= 1000
if n == -1000:
    print(0)
else:
    print(abs(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N%1000:
    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:
a = input()
b = int(a[-3:])
if b==0:
    print(0)
else:
    c = 1000-b
    print(c)

Submission status: Accepted

Solution code:
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

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

Submission status: Accepted

Solution code:
n = int(input())
m=0
while m<n:
    m+=1000
print(m-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(-(-N//1000)*1000 - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n<=1000:
  print(1000-n)
elif 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 time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

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

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N = In.int()

i = 1

while i*1000<N:
    i+=1

Out.int(i*1000 - N)


######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

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()
a = int(n[-3:])
if a == 0:
	print(0)
else:
	print(1000-a)

Submission status: Accepted

Solution code:
N = int(input())
k = N//1000
if N%1000==0:
  print(0)
else:
  print(1000*(k+1)-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:
import math
n = int(input())
m = math.ceil(n/1000)
print(m*1000-n)

Submission status: Accepted

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

while money < n:
    money += 1000

print(money-n)

Submission status: Accepted

Solution code:

N =int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

while money < N:
  money += 1000

print(money - N)

Submission status: Accepted

Solution code:
#ABC173A おつりはいくらいになりますか。

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
money=1000

while 1:
  if N<=money:
    ans=money-N
    break
  money=money+1000

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N=int(input())

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

Submission status: Accepted

Solution code:
a = int(input())
b = a
while True:
  if a % 1000 != 0:
    a += 1
  else:
    break
print(a-b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k = int(input())

print((1000 - k%1000)%1000)

Submission status: Accepted

Solution code:
input_line = int(input())
a = input_line % 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))

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

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

Submission status: Accepted

Solution code:
N = int(input())

amari = N % 1000

answer = 1000 - amari
if answer == 1000:
	answer = 0

print(answer)

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(0, 20000 , 1000):
    if i >= n:
        break
print(i - n)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)