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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(input()[-3:])

Submission status: Wrong Answer

Solution code:
n=int(input())
import sys
if n<=1000:
    print(1000-n)
    sys.exit()
if n==10000:
    print(0)
    sys.exit()
a=n//1000
b=n%1000
print(1000-(n-a*1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys

def main():

    input = sys.stdin.buffer.readline
    n = int(input())
    ans = n
    while True:
        ans = ans - 1000
        if(ans < 1000):
            print(ans)
            break

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
s=1000
f=0
for i in range (1,len(n)):
    if n[i]!='0':
        f=1
        break
if f==0:
    print((s*(int(n[0])))-int(n))
else:
    print((s*(int(n[0])+1))-int(n))

Submission status: Wrong Answer

Solution code:
N = int(input())
d = N / 1000

d = d - int(d)
d = d*10

if d == 0:
    print(0)
else:
    print(int(d*100))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def Next(): return input()
def NextInt(): return float(Next())


N = round(NextInt()*0.0010, 3)
import math
ans = math.ceil(N)
print(ans)
print(int(ans*1000-N*1000))

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
print(math.floor(n//1000))

Submission status: Wrong Answer

Solution code:
i = int(input())
j = int(i / 1000) + 1
okane = j * 1000 

print(okane - i)

Submission status: Wrong Answer

Solution code:
N = int(input()) 

while N > 0:
  N = N - 1000

print(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%1000==0:
	print(0)
else:
	for i in range(1,10001,1000):
		if N <=1000:
			print(1000-N)
		if i >=N:
			print(i-N)
			break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

res = N // 1000
res += 1

con = res * 1000

oturi = con - N

print(oturi)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

s = int(s)

print(1000 - (s % 1000))

Submission status: Wrong Answer

Solution code:
str = input()
# print(str)

a = int(str)

b = a /1000
c = a % 1000

# print(b)
print(c)

Submission status: Wrong Answer

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

elif N<1000:
  print(1000-N)

Submission status: Wrong Answer

Solution code:
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	n=int(input())
	if n == 3000:
		print('0')
	else:
		print(n-1800)
			
		
main()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    if n < 1000:
        ans = 1000 - n
    else:
        if n % 1000 == 0:
            ans = 0
        elif n % 1000 <= 500:
            ans = n % 1000    
        else:
            ans = ans = 1000 - (n % 1000)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = str(input())
N0 = N[0:1]
print((int(N0) + 1) * 1000 - int(N))

Submission status: Wrong Answer

Solution code:
N =int(input())
L = N % 1000
if 0<= L <500:
    print(L)
elif 500<= L < 1000:
    P = N // 1000
    K = 1000 - L
    print(K)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

print(x % 1000)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(N)

Submission status: Wrong Answer

Solution code:
n = int(input()) #10000以下

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(1000 - a)

Submission status: Wrong Answer

Solution code:
input_yen = int(input())
unit_yen = 1000

required_bill = int(float(input_yen)/unit_yen) * unit_yen
print(required_bill - input_yen)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1000
if n<100:
    print(n-ans)
    exit()
else:
    ans=1000
    while(n>ans):
        if ans==n:
            break
        elif ans>n:
            break
        else:
            ans+=1000
print(abs(n-ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
r = n
while (True):
  r = r - 1000
  if r <= 1000:
    break
if r == 0:
  print(0)
else:
  print(1000 - r)

Submission status: Wrong Answer

Solution code:
num = int(input()) #ここで標準入力
i = 0

while True:
    ans = 1000*i - num
    if ans > 0:
        break
    i += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 100000000 - N
M = str(M)
if M[-3:] == '000':
  print(0)
else:
  print(M[-3:])

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N =int(input())
L = N % 1000
if 0<= L<=500:
    print(L)
elif 500< L < 1000:
    P = N // 1000
    K = 1000 - L
    print(K)

Submission status: Wrong Answer

Solution code:
N=int(input())
if 1<=N<=1000:
	print(1000-N)
elif N==10000:
	print(0)
else:
	A=N//1000+1
	print(1000*A-N)

Submission status: Wrong Answer

Solution code:
N = int(input()) 

while N >= 0:
  N = N - 1000
  
N = N * -1

print(N)

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    num = int(input())

    while True:
      new_num = num - 1000
      if new_num < 0:
        ans = new_num * -1
        break
      num = new_num
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N <1000:
    print(1000 - N)
else:
    tmp = N // 1000
    tmp = 1000 * (tmp +1)
    print(tmp - N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


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


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
if n % 1000 == 0:
    print(n//1000)
    exit()
for i in range(1, 10001):
    if(0 < 1000*i-n):
        print(1000*i-n)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())


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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1000
if n<100:
    print(n-ans)
    exit()
else:
    ans=1000
    while(n>=ans):
        if ans==n:
            break
        elif ans>n:
            break
        else:
            ans+=1000
print(abs(n-ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 1000:
    print(1000-n)
elif 1000< n <=2000:
    print(2000-n) 
elif 2000< n <=3000:
    print(3000-n)
elif 3000< n <=4000:
    print(4000-n)
elif 4000< n <=5000:
    print(5000-n)
elif 5000< n <=6000:
    print(6000-n)
elif 6000< n <=7000:
    print(7000-n)
elif 7000< n <=8000:
    print(8000-n)
elif 8000< n <=9000:
    print(9000-n)
elif 9000< n <=10000:
    print(10000-n)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

print(price)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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




if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
N =int(input())
L = N % 1000
if 0<= L<=499:
    print(L)
elif 500<= L < 1000:
    P = N // 1000
    K = 1000 - L
    print(K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
N=int(input())
i=0
for i in range(0,10000,1000):
    if i >= N:
        print(i-N)
        sys.exit()

Submission status: Wrong Answer

Solution code:
n = int(input()) #10000以下

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    i = str(n)
    an = str(int(i[0])+1) + str("0"*(len(str(n))-1))
    print(int(an)-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input()) #10000以下

for i in range(11):
  if n >= 1000:
    n -= 1000
  else:
    print(n)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = N
for i in range(1,10):
    ans -= 1000
    if ans >= 1000:
        continue
    elif 1000 > ans > 0:
        a = 1000 - ans
        print(a)
        break
    elif ans == 0:
        print(0)
        break

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n = int(input())
    print((n//1000)*1000 - n)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
num = int(input()) #ここで標準入力
i = 0

while True:
    ans = num - 1000*i
    if ans < 1000:
        break
    i += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
A=0
for i in range(0,10):
    i=i+1
    A=(i+int("0"))*100
    if N<=A:
        print(A-N)
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
a = N // 1000
b = N % 1000

if b == 0:
    ans = 0
else:
    ans = N - a * 1000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

a = 1000

for i in range(n//1000 + 1):
  if  n <= a*i :
    c = a*i - n
    print(c)  
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

n=int(N/1000)
n=(n+1)*1000
print(n-N)

Submission status: Wrong Answer

Solution code:

a = int(input())

while a >= 1000:
    a = a - 1000

print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%1000==0:
	print(0)
else:
	for i in range(0,10000,1000):
		if i >N:
			print(i-N)
			break

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n = int(input())
    print(n - (n//1000)*1000)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
price = int(input())
mult, res = divmod(price, 1000)
answer = 1000 - res
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 1000:
    print(1000-n)
elif 1000<= n <2000:
    print(2000-n) 
elif 2000<= n <3000:
    print(3000-n)
elif 3000<= n <4000:
    print(4000-n)
elif 4000<= n <5000:
    print(5000-n)
elif 5000<= n <6000:
    print(6000-n)
elif 6000<= n <7000:
    print(7000-n)
elif 7000<= n <8000:
    print(8000-n)
elif 8000<= n <9000:
    print(9000-n)
elif 9000<= n <10000:
    print(10000-n)
elif n==10000:
    print(0)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    if N < 1000:
        print(1000 - N)
        return
    N = str(N)
    N = N[-3] + N[-2] + N[-1]
    N = int(N)
    print(1000 - N)
    
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input()) - 1
k = list(str(n))
kk = int(k[0])
print((kk + 1)*1000 - n - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for i in range(math.floor(N/1000)):
  N -= 1000
print(1000 - N)

Submission status: Wrong Answer

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

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




if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
in_value = int(input())

while(1):
    in_value %= 1000
    if in_value < 1000:
        print(in_value)
        break

Submission status: Wrong Answer

Solution code:
cost = input()[0]
mod = int(cost) % 1000
print(mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = int(input())

if n >= 1000:
    a = (n//1000 + 1)*1000
    print(a - n)
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = 1000

for i in range(n):
  if  n <= a*i :
    c = a*i - n
    print(c)  
    break

Submission status: Wrong Answer

Solution code:
n = int(input())

c = round(n+500, -3)

print(c-n)

Submission status: Wrong Answer

Solution code:
n = int(input())
r = n
for i in range(n):
  r = r - 1000
  if r <= 1000:
    break
print(1000 - r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

m = n % 1000

print(1000-m)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N <1000:
    print(N)
else:
    print(1000 - N % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
N %= 1000
if N != 1000:
	N = 1000 - N
if N == 1000:
	N = 0
count = 0
if N >= 500:
  N -= 500
  count += 1
while N >= 100:
  N -= 100
  count += 1
while N >= 50:
  N -= 50
  count += 1
while N >= 10:
  N -= 10
  count += 1
while N >= 5:
  N -= 5
  count += 1
while N >= 1:
  N -= 1
  count += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
q, mod = divmod(n, 1000)

if mod == 0:
    print(0)
else:
    print(q * 1000 - mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(N % 1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


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


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
if n % 1000 == 0:
    print(n//1000)
    exit()
tmp = n//1000
# print(tmp)
print((tmp+1)*1000-n)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

print(1000-N%1000)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n >= 1000:
  siharai = n % 1000
  otsuri = 1000 - siharai
  print(otsuri)
  
else:
  otsuri = 1000 - n
  print(otsuri)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

elif N<1000:
  print(1000-N)

Submission status: Wrong Answer

Solution code:
n = int(input())
#n,k = map(int,input().split())
#a = list(map(int,input().split()))
#mod = pow(10,9) + 7
if(n == 10000):
    print(0)
else:  
    print(1000-n%1000)
'''
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
print(a)
'''

Submission status: Wrong Answer

Solution code:
import sys

def main():

	N = int(input())
	m = N%1000
	print(1000 - m)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input(""))

A = N % 1000

if A > 1:
      B=1000-A
      print(B)
else:
      print(A)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
for i in range(math.floor(N/1000)):
  N -= 1000
print(N)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=0
for i in range(0,10):
    i=i+1
    A=i+int("000")
    if N<=A:
        print(A-N)
        break

Submission status: Wrong Answer

Solution code:
#A - Payment
N = int(input())
a = N % 1000
if N < 1000 :
    ans = 1000- a
elif a < 500:
    ans = 1000 - a
else:
    ans = 1000-a

print(ans)

Submission status: Wrong Answer

Solution code:


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

    s = A % 1000

    print(1000-s)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def Next(): return input()
def NextInt(): return int(Next())
N = NextInt()*0.001
import math
ans = math.ceil(N)
print(int(ans*1000-N*1000))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    ans = 1000 - x
else:
    ans = 1000 - N

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
price = int(input())
  
mod = int(price/1000)

print((mod+1)*1000 - price)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print (1000 - amari)

Submission status: Wrong Answer

Solution code:
num = int(input()) #ここで標準入力
i = 0

while True:
    i += 1
    ans = num - 1000*i
    if ans < 1000:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
n = N
for i in range(N):
    n -= 1000
    if(n <= 1000):
        print(1000-n)
        exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(int(N % 1000))

Submission status: Wrong Answer

Solution code:
n = int(input())

m = n % 1000

if m > 500:
    print(1000-m)
else:
    if n < 1000:
        print(1000-n)
    else:
        print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

a = n // 1000

rem = n - 1000 * a
if rem == 0:
    print(0)
else:
    print(rem)

Submission status: Wrong Answer

Solution code:
N = int(input())

a = (N // 1000 + 1) * 1000

A = a - N

print(A)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict

# read line as a string
# strr = input()

# read line as an integer
k = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
# arr = list(map(int,input().split()))

print(k%1000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

def main():

	N = int(input())
	print(N%1000)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a = int(input())

mod = a % 1000

b = mod - 1000

c = int(abs(b))

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


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


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
if n % 1000 == 0:
    print(n//1000)
    exit()
tmp = n/1000
# print(tmp)
print((math.ceil(tmp)*1000)-n)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

a = 1000

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 1000 == 0:
  print(0)
else:
  res = n // 1000
  rem = (1000 * (res + 1)) % n
  print(rem)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    if n % 1000 == 0:
        ans = 0
    elif n % 1000 <= 500:
        ans = n % 1000    
    else:
        ans = ans = 1000 - (n % 1000)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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