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

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

Submission status: Accepted

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

Submission status: Accepted

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

if n%1000 != 0:
  m = n//1000 + 1

if m != 0:
    m = m*1000 - n

print(m)

Submission status: Accepted

Solution code:
import math

N = int(input())

if N >=1000:
    N2 = math.ceil(N/1000)*1000
else:
    N2 = 1000

print(N2-N)

Submission status: Accepted

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

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:
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
# mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file=1





def solve():


    # for _ in range(ii()):
    
        

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








        
if __name__ =="__main__":

    if(file):

        if path.exists('input1.txt'):
            sys.stdin=open('input1.txt', 'r')
            sys.stdout=open('output1.txt','w')
        else:
            input=sys.stdin.readline
    solve()

Submission status: Accepted

Solution code:
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
# mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file=0





def solve():


    # for _ in range(ii()):
    
        

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








        
if __name__ =="__main__":

    if(file):

        if path.exists('input1.txt'):
            sys.stdin=open('input1.txt', 'r')
            sys.stdout=open('output1.txt','w')
        else:
            input=sys.stdin.readline
    solve()

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
import sys
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

while N>1000:
    N = N - 1000

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

def f(y):

    if 1 <= y <=999:
        print(1000-y)
    elif 1000<= y <= 10000 :
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and y % 1000!=0:
            print("500")
        elif y % 100==0 and y % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and y % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input()
x = f(int(y))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
for i in range(100):
  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:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
for i in range(1,100):
    v = 1000 * i

    if N <= v:
        print(v-N)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N =int( input() )

N = 10000 - N

print( str(N % 1000) )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(n-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
contador = 0
m = 1
while (contador < 1):
    if m*1000 >= N:
        contador = 1
    else:
        m=m+1
print(m*1000 - N)

Submission status: Accepted

Solution code:
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if n%1000 == 0:
        print(0)
    else:
        maisu = n//1000 + 1
        oturi = 1000*maisu - n
        print(oturi)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#標準入力の受付
N = 0
while((1 > N) | (N > 10000) | (type(N) is not int)):
	N = int(input())
#入力を超える1000円単位の金額の算出
tmp = N / 1000
i = 0
while(True):
    if(i >= tmp):
    	break
    i += 1

charge = i * 1000 - N
print(charge)

Submission status: Accepted

Solution code:
import math
def main():
  p = int(input())
  p2 = math.ceil(p/1000)*1000
  ans = p2 -p
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

Submission status: Accepted

Solution code:
n = int(input())

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

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())
t = 1000-n
while(t<0):
    t+=1000
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
n=(n/1000)
c=math.ceil(n)
a=round((c-n)*1000)
print(a)

Submission status: Accepted

Solution code:
money=int(input())
i=0
while i<=money:
    if i*1000>=money:
        break
    else:
        i+=1
print(i*1000-money)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

MOD = N % 1000
ANS = 1000 - MOD

if (MOD == 0):
  print(0)
else:
  print(ANS)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import Counter,deque,defaultdict
L=lambda:list(map(int,input().split()))
M=lambda:map(int,input().split())
I=lambda:int(input())
IN=lambda:input()

def solve():
    n=I()
    if n%1000==0:
        print(0)
    else:
        print(1000-n%1000)
for _ in range(1):
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if price%1000==0:
  print(0)
else:
  otsuri = 1000 - price%1000
  print(otsuri)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while Num > 0:
    OTURI = 1000 - Num
    Num -= 1000
  
print(OTURI)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n = I()
    if n % 1000 == 0:
        print(n % 1000)
    else:
        print(1000 - (n % 1000))
    return


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def payment(N):
    if N % 1000 == 0:
        return 0
    else:
        return 1000 - N % 1000

if __name__ == '__main__':
    N  = int(input())
    print(payment(N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = float(input())
p = n//1000
if n%1000!=0:
	p+=1
print (int(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())
a = n%1000
b = 1000-a
if b == 1000:
  b = 0
print(b)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

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())
a = int(n/1000-0.0001)*1000
n = n-a
print(1000-n)

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8

N = int(input())

C = int(1000 - N % 1000)
C = int(C % 1000)

print("{}".format(C))

Submission status: Accepted

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


print(main())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

amari = n % 1000

if amari == 0:
    print(0)
else:
    oturi = (1000 - amari)
    print(oturi)

Submission status: Accepted

Solution code:
print(int(str(1000 - int(input()[-3:]))[-3:]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Jul  9 15:33:42 2020

@author: TatsuyaYamamoto
"""

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

Submission status: Accepted

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

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

output = 0
if money <= 1000:
  output = 1000 - money
elif money % 1000 == 0:
  output = 0
else:
  output = 1000 - (money % 1000)
  
print(output)

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())
p=N//1000+min(1,N%1000)
print(1000*p-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# A - Payment
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while x <= n:
    x += 1000

print((x - n) % 1000)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    arg = int(input())
    if arg % 1000 == 0:
        ans = 0
    else:
        ans = 1000 - (arg % 1000)
    print(str(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import heapq
import queue
import itertools
import functools
import operator
import time

readline = sys.stdin.readline
 
IPS = lambda: readline().rstrip()
IP = lambda: int(readline().rstrip())
MP = lambda: map(int, readline().split())
LS = lambda: list(map(int, readline().split()))

def solve():
    for _ in range(1):
        n = IP()
        d = int(n//1000)
        print( ((d+1)*1000 - n)%1000)
       
       
if __name__ == "__main__":
    solve()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
price = int(input())
sen = 1000
senCnt = int(price / 1000)
num = 0

if price % sen != 0:
    senCnt = senCnt + 1
    sen = sen * senCnt
    num = sen - price
    
print(num)

Submission status: Accepted

Solution code:
N=int(input())
a=0
if N<1000:
    print(1000-N)
    exit()
else:
    while 1:
        if a*1000-N>=0:
            print(a*1000-N)
            exit()
        else:
            a+=1

Submission status: Accepted

Solution code:
N=int(input())
a=0
if N<1000:
    print(1000-N)
    exit()
else:
    while 1:
        if 0<=a*1000-N:
            print(a*1000-N)
            exit()
        else:
            a+=1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

amari = n % 1000

if amari == 0:
    print(0)
else:
    oturi = (1000 - amari)
    print(oturi)
# oturi = (1000 - amari) % 1000

Submission status: Accepted

Solution code:
n = int(input())

amari = n % 1000

oturi = (1000 - amari) % 1000

# maisuu = n / 1000
# amari = n - maisuu*1000
# oturi = 1000 - amari

# if amari > 0:
#     maisuu += 1

print(oturi)

Submission status: Accepted

Solution code:
n = int(input())

# while n >= 1000:
#     n -= 1000
#     n = max(n, 0)

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

# print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
price = int(input())

change = 1000 - (price % 1000)
if change == 1000:
    change = 0

print(change)

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())
pay = 1000
while True:
    if pay < n:
        pay += 1000
        continue
    print(pay - n)
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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