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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

n = N/1000

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

i=1

while i*1000 < n:
    i += 1

print(i*1000 -n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

if n % 1000 == 0:
    print(0)
else:
    x = n // 1000 + 1
    ans = 1000 * x - n
    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:
import sys
n = int(input())
for i in range(100):
  if 1000*i >= n:
    print(1000*i - n)
    sys.exit()

Submission status: Accepted

Solution code:
n=int(input())

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

print(ans)

Submission status: Accepted

Solution code:


def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip())
    result = 1000 - n % 1000 if n % 1000 != 0 else 0
    print(result)



if __name__ == "__main__":
    resolve()


# を理解する。そうすると、明らかに制限時間内に実行が終わらないソースコードを出さなくなる。ちなみに、競プロでは 108108 ～ 109109 回程度のループが回せるといわれている。

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理
ans = (1000 - (N % 1000)) % 1000

# 結果出力
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

while money > 1000 :
	if int(money/1000) >= 1:
		money -= 1000

rest = 1000-money
print(rest)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


#=input()
n=int(input())
ans=0
if n<1000:
    ans=1000-n
else:
    ans=n%1000
    if ans==0:
        ans=0
    else:

        ans=1000-ans
print(ans)
#n,m,x = map(int, input().split())

Submission status: Accepted

Solution code:
import math

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

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

print(otsuri)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def abc173_a():
    N = int(input())
    #N = 3000%1000
    if N%1000 ==  0:
        print(0)
    else:
        print(1000-N%1000)






abc173_a()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = N % 1000
if a == 0:
  print(0)
  import sys
  sys.exit()
a = 1000 - a

print(a)

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:
import math
i = int(input())
ii=1000-(i-math.floor(i/1000)*1000)
if (ii == 1000): ii=0
print (ii)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
r = 0
if n % 1000 != 0:
  while n > 0:
    n -= 1000
  r = abs(n)
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 if(n%1000!=0) else 0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
pay = 1000
while pay < N:
    pay += 1000

print(pay - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(0, 10001, 1000):
    if N <= i:
        break

print( i-N )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
product = int(input())

remain = product % 1000
if remain != 0:
    change = 1000 - remain
else:
    change = 0
print(change)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(1000 * i - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

A = N % 1000

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
while N > ans:
    ans += 1000

print(ans-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

hoge = N // 1000 + 1

if N % 1000 == 0:
    oturi = 0
else:
    oturi = 1000 * hoge - N

print(oturi)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import time
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/7/5 19:54
# @Version : 1.1
# @Author  : Jade
# @File    : a.py
# @Software: PyCharm
#

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
# coding: utf-8
# Your code here!

n = int(input())
mai = n//1000
mai += 1
if mai*1000-n == 1000:
    print((mai-1)*1000-n)
else:
    print(mai*1000-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    N = int(input())
    a = 1000 - N % 1000
    if a == 1000:
        a = 0
    print(a)

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

Submission status: Accepted

Solution code:
price = int(input())

if (price % 1000) == 0:
	payment = price
else:
	payment = (price // 1000 + 1) * 1000

otsuri = payment - price
print(otsuri)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

res = int(math.ceil(N / 1000)) * 1000 - N

print(res)

Submission status: Accepted

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

n = int(input())

i = 1000
while True:
    if n > i:
        i += 1000
    else:
        ans = i-n
        break

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:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
count =0
ans =-1
while ans <0:
    count +=1
    ans =count *1000 -N
    if ans >=0:
        print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
input = sys.stdin.readline
n = int(input())
if (n % 1000 == 0):
  print(0)
else:
  m = (math.ceil(n / 1000)) * 1000
  print(abs(m-n))

Submission status: Accepted

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

bills = (n + m - 1) // m

ans = bills*m-n
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

A = N % 1000

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

Submission status: Accepted

Solution code:
N = int(input())
i = 1000
while i < N:
    i += 1000

print(i - N)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    N = int(input())
    m = N % 1000
    if m == 0:
        print(0)
    else:
        print(1000 - m)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

while 1:
    x = x - 1000
    if x <= 0:
        break

print(abs(x))

Submission status: Accepted

Solution code:
"""while True:
        break"""
    

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = n % 1000

if ans != 0:
  ans = 1000 - ans

if ans == 0:
  ans == 0
    
print(ans)

Submission status: Accepted

Solution code:
a = int(input())

b = int(a // 1000)

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    print(min([i*1000 - n if i*1000 - n >= 0 else float("inf")
               for i in range(1, 100)]))
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N =int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0

for i in range(1,11):
    if cnt < N:
        cnt += 1000

print(cnt-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:
def main():
    N = int(input())
    a = N % 1000
    while N > 0:
        N -= 1000
    print(-N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N = int(input())
if N % 1000 == 0:
    print(N % 1000)
else:
    n = 1000 - N % 1000
    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:
# -*- coding: utf-8 -*-
N = int(input())
if N%1000 == 0:
  print(0)
else:
  print(1000-(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:
N=int(input())

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

Submission status: Accepted

Solution code:
def resolve():
    pay = int(input()[-3:])
    rest = 1000 - pay
    if pay == 0:
        print(0)
    else:
        print(rest)

resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())
minimum=0
for i in range(10):
    if N>minimum:
        minimum+=1000
change=minimum-N
print(change)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

temp = a % 1000

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

while True:
    if n > 1000:
        n = n - 1000
    else:
        n = 1000 - n
        break

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

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

Submission status: Accepted

Solution code:
N = input()
n = N[-3:]

ans = 1000 - int(n)

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

Submission status: Accepted

Solution code:


n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

print(int(1000 * np.ceil(N/1000) - N))

Submission status: Accepted

Solution code:
#関数リスト
import sys
input = sys.stdin.readline

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))


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

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np
import functools
import operator
import collections
import itertools
N=int(input())
count=0
for i in range(N):
    count+=1000
    if count>=N:
        print(count-N)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n  = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:

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

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

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

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1, 11):
  m = 1000 * i
  if m >= n:
    print(m - n)
    break
  else:
    pass

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

calc=N%1000

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

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

else:
    print(1000-N%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())

    a = (n // 1000) * 1000
    a = a if n % 1000 == 0 else a + 1000

    print(a - n)


if 'unittest' not in globals():
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

Submission status: Accepted

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

print(otsuri)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

print( (10000 - n) % 1000 )

Submission status: Accepted

Solution code:
N = int(input())

tmp = N % 1000

result = 1000 - tmp

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

Submission status: Accepted

Solution code:
n = int(input())

n2 = n % 1000 
if n2 != 0:
    print(1000 - n2)
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:
# -*- coding: utf-8 -*-
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:
  ans = 0
else:
  ans = 1000 - (N % 1000)

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

sen = int((N-0.1)//1000)

hyakuika = N-sen*1000

ans = int(1000 - hyakuika)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000*math.ceil(N/1000)-N)

Submission status: Accepted

Solution code:
N = int(input())

mod = N%1000

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    r = N % 1000
    ans = 0
    if r % 1000 != 0:
        ans = 1000 - r
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = (n % 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+1) - n)

Submission status: Accepted

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

sum =0
cnt =1

while True:
    
    sum = 1000*cnt
    
    if N <=sum:
        print(sum-N)
        break
    else:
        cnt+=1

Submission status: Accepted

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

Submission status: Accepted

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

a = int(input())
b = a // 1000

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

Submission status: Accepted

Solution code:
n=int(input())

if n%1000==0:
    print(0)
    exit()
n-=1000*(n//1000)

print(1000-n)