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:
import math
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    n = int(input())
    while n > 1000:
        n -= 1000
    print(1000 - n)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while(True):
    if n <= 1000:
        ans = 1000 - n
        break
    n -= 1000
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin,stdout
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math
import math
import time
from queue import Queue
# PradeepGhosh_2017076

def seive(n):
	l=[True]
	l=l*(n+1)
	for i in range(2,int(sqrt(n))+1):
		if(l[i]==True):
			val=i*i
			while(val<len(l)):
				l[val]=False
				val+=i
	prime=[]
	for i in range(2,len(l)):
		if(l[i]==True):
			prime.append(i)
	return prime

def dp(l,i,n,val,ans):
	if(i>=n or val<0):
		return 1000000
	elif(val==0):
		return 0
	else:
		if(ans[i]==1000000):
			ans[i]=min(min(1+dp(l,i+1,n,val-l[i],ans),1+dp(l,i,n,val-l[i],ans)),dp(l,i+1,n,val,ans))
		return ans[i]
from queue import Queue
def factors(n):
	l=[]
	for i in range(1,int(sqrt(n))+1):
		if(n%i==0):
			if(n//i==i):
				l.append(i)
			else:
				l.append(i)
				l.append(n//i)
	return l
def check1(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v-=1
def check2(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v+=1

def up(n):
	j=n-1
	while(j>0):
		if(n%j==0):
			break
		j-=1
	return j		
def fac(n):
	c=1
	i=1
	while(i<=n):
		c*=i
		i+=1
	return c
def check_happy(n):
	ss=set()
	print(n)
	while(n!=1):
		val=n
		s=0
		print(val)
		while(val!=0):
			s+=(val%10)**2
			val=val//10
		print(val)
		print("hi")
		if(val in ss):
			return False
		else:
			n=val
			ss.add(n)
	return True
if __name__ == '__main__':
	n=int(input())
	print(1000*(int(math.ceil(n/1000)))-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = 1000
while True:
    if P - N >= 0:
        print(P - N)
        break
    P += 1000

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

x = math.ceil(N/1000)

print(x * 1000 - N)

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 = input()
N = N[-3:]

if N == '000':
    print(0)
else:
    N = int(N)
    print(1000-N)

Submission status: Accepted

Solution code:
n = int(input())
ans = 100000
for i in range(15):
    if i*1000 - n >= 0:
        ans = min(i*1000-n, ans)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
money = int(input())
yen = 0 
while yen < money:
  yen = yen + 1000

print(yen - money)

Submission status: Accepted

Solution code:
A = int(input())

result = A%1000

if result != 0:
    result = 1000 - result

print(result)

Submission status: Accepted

Solution code:
a = int(input())

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

a = abs(a)
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 1000 == 0:
    print(0)
else:
    A = N // 1000
    print(1000*(A+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:
N = int(input().zfill(4)[-3:])
if N == 0:
    print(N)
else:
    print(1000-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N =  int(input())

i = 1
while(True):
  change = 1000*i - N
  if change < 0:
    i+=1
  else:
    break

print(change)

Submission status: Accepted

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

Submission status: Accepted

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

a= math.ceil(n / 1000)

print (a * 1000 -n )

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

if __name__ == "__main__":
	main()

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()

b = 1000

while int(a) > b:
	b += 1000

print(b-int(a))

Submission status: Accepted

Solution code:
n = int(input())
ans = 1000
while n > ans:
    n = n - 1000


print(ans -n)

Submission status: Accepted

Solution code:
N = int(input())

mod = N % 1000
if mod == 0:
  result = 0
else:
  result = 1000 - mod

print(result)

Submission status: Accepted

Solution code:
# coding: utf-8
# 日本語を入力できるようにするために上記一文が必要


N = int(input())

chash = 0
while chash < N:
        chash += 1000

print(chash - N )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

digit = len(str(n))

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
tmp,res = 0,0
tmp = n - (n//1000)*1000
if tmp == 0:
    res = 0
else:
    res = 1000-int(tmp)
print(res)

Submission status: Accepted

Solution code:
n = input()
if int(n) <= 1000:
  print(1000-int(n))
else:
  if int(n) % 1000 == 0:
    print(0)
  else:
    x = 1000-(100 * int(n[1]) + 10 * int(n[2]) + int(n[3]))
    print(x)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

while N > 1000:
    N = N - 1000

print(1000 - N)

Submission status: Accepted

Solution code:
a=int(input()) 

ans = a % 1000

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

S = int(N / 1000)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
div, mod = divmod(N, 1000)
if mod > 0:
    print(1000 - mod)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
res=0
cont=1
while n>0:
    n=n-(1000*cont)

print(abs(n))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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)

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
num = int(stdin.readline().rstrip())
a = int(num/1000)+1
res = (a*1000-num) % 1000
print(res)

Submission status: Accepted

Solution code:
N = int(input())
i = 0
while True:
    i += 1000
    if i >= N:
        break
print(i - N)

Submission status: Accepted

Solution code:
n = int(input())

if n < 1000:
    print(1000 - n)

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

else:

    x = n // 1000

    y = (x+1)*1000

    print(y-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

if N<=1000:
    ans=1000-N
    print(ans)
    exit()
elif N<=2000:
    ans=2000-N
    print(ans)
    exit()
elif N<=3000:
    ans=3000-N
    print(ans)
    exit()
elif N<=4000:
    ans=4000-N
    print(ans)
    exit()
elif N<=5000:
    ans=5000-N
    print(ans)
    exit()
elif N<=6000:
    ans=6000-N
    print(ans)
    exit()
elif N<=7000:
    ans=7000-N
    print(ans)
    exit()
elif N<=8000:
    ans=8000-N
    print(ans)
    exit()
elif N<=9000:
    ans=9000-N
    print(ans)
    exit()
else:
    ans=10000-N
    print(ans)
    exit()

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(11):
  if 1000 * i >= N:
    ans = 1000 * i - N
    break
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:
N = input()

money = int(N[-3:])
if money == 0:
    money = 1000
print(1000 - money)

Submission status: Accepted

Solution code:
N = int(input())

a = 1000

while N>a:
  a += 1000
  
print(a-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os

N = int(input())

modN = N % 1000
if modN != 0:
    res = 1000 - modN
else:
    res = 0

print(res)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit, stdout
#setrecursionlimit(1000000) #use "python" instead of "pypy" to avoid MLE
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
#from heapq import heapify, heappop, heappush, heapreplace, heappushpop
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def si(): return stdin.readline().rstrip()
def lsi(): return list(si())
#mod=1000000007
res=['YES', 'NO']





test_case=1
while test_case:
    test_case-=1




    n=ii()+999
    x=n//1000
    print(x*1000-n+999)

Submission status: Accepted

Solution code:
N = int(input())
if N < 1000:
    print(1000-N)
else:
    
    L = str(N)
    L1 = str(L[-3] + L[-2] + L[-1])
    N1 = int(L1)
    if N1 == 0:
        print(0)
    else:
        print(1000 - N1)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    while n>0:
        n = n - 1000

    print(abs(n))
    
resolve()

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

while n >= 1000:
    n -= 1000

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

Submission status: Accepted

Solution code:

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

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

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

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

Submission status: Accepted

Solution code:
n = input()
if len(n) < 3:
    print(1000- int(n))
else:   
    value = n[-3]+n[-2]+n[-1]
    #print(value)
    value_int = int(value)
    if value == '000':
        print(0)
    else:
        print(1000 - value_int)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    if N % 1000 == 0:
        ans = 0
    else:
        ans = 1000*(N//1000+1)-N
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)

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

if __name__=='__main__':
  main()

Submission status: Accepted

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

while n > t:
  t += 1000

print(t - n)

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

Submission status: Accepted

Solution code:
a = int(input())

ans = a % 1000

if ans != 0:
    ans = 1000 - ans
print(str(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

d = input("")
d = int(d)

while d > 1000:
  d = d - 1000

d = 1000 - d

print(d)

Submission status: Accepted

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

Submission status: Accepted

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

if change == 1000:
  change = 0
print(change)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

flag = True
count = 0
money = 0

while(flag):
    money += 1000
    count += 1
    if money >= N:
        flag = False

print(count * 1000 - N)

Submission status: Accepted

Solution code:
N = int(input())

Q = N - 1000

while Q > 0:
    Q = Q - 1000

print(abs(Q))

Submission status: Accepted

Solution code:
import math

n = int(input())

num_bills = math.ceil(n / 1000)

change = (1000 * num_bills) - n

print(change)

Submission status: Accepted

Solution code:
n = int(input())
# n=3000
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:
  otsuri = (N // 1000 + 1) * 1000 - N 
  print(otsuri)

Submission status: Accepted

Solution code:
import math
n = int(input())
k = 1000
p = n/k
if p - int(p) == 0:
  print(0)
  
else:
  x = math.ceil(p)*1000
  print(x-n)

Submission status: Accepted

Solution code:
A = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

while a>0:
	a-=1000

print(abs(a))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

else:
    print(1000-n%1000)

Submission status: Accepted

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

Submission status: Accepted

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

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())
for i in range(10):
    if 1000*i < n <= 1000*(i+1):
        ans = 1000*(i+1) - 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:
N = int(input())
otsuri = N % 1000
if not otsuri == 0:
    otsuri = 1000 - otsuri
print(otsuri)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n % 1000 == 0:
        print(0)
        exit()

    ans = 1000 - n % 1000
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


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


def main():
    N = I()
    ans = 0

    while True:
        if N >= 1000:
            N -= 1000
            if N ==0:
              break
        else:
            ans = 1000-N
            break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
my_money = 1000
for i in range(10):
  if my_money < N:
    my_money += 1000
  else:
    print(my_money - N)
    exit()

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math

# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A = list(map(int, input().split()))
s = int(input())
if s % 1000 == 0:
    print('0')
    sys.exit()
print(((s//1000)+1)*1000-s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1000, 10001, 1000):
    if i - N > -1:
        print(i - N)
        break
    else:
        continue

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A

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

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

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

a=one_int()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

if n % 1000 == 0:
    print(0)
else:
    x = math.ceil(n / 1000)
    print(x*1000 - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(1000 - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

n = i_in()
ans = -n + ceil(n/1000) * 1000

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
for i in range(13):
    if 1000 * i < N and N <= 1000 * (i + 1):
        print(1000 * (i + 1) - N)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

def main():
    mod=10**9+7
    N=I()
    t=(N+1000-1)//1000
    print(t*1000-N)

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys


def resolve():
    readline = sys.stdin.readline    # 1行だけ文字列にする

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

while n > 0:
    n -= 1000

n *= -1
print(n)

Submission status: Accepted

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