Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345 are not.

You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year.


-----Input-----

The first line contains integer number n (1 ≤ n ≤ 10^9) — current year in Berland.


-----Output-----

Output amount of years from the current year to the next lucky one.


-----Examples-----
Input
4

Output
1

Input
201

Output
99

Input
4000

Output
1000



-----Note-----

In the first example next lucky year is 5. In the second one — 300. In the third — 5000.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = input()
ans = (int(n[0]) + 1) * 10 ** (len(n) - 1)
print(ans - int(n))


a = input()
b = int(a)
f = int(a[0])
if int(a) < 10:
	print(1)
elif f < 9:
	print((f + 1) * 10 ** (len(a) - 1) - int(a))
else:
	print(10 ** len(a) - int(a))


n = int(input())
y = 1
d = 0
while y <= n:
	y += 10 ** d
	if y // 10 ** (d + 1) == 1:
		d += 1
print(y - n)


def main():
	year = input()
	if len(year) < 2:
		result = 1
	else:
		next_year = [year[0]] + ['0'] * (len(year) - 1)
		next_year[0] = str(int(next_year[0]) + 1)
		next_year = ''.join(next_year)
		result = int(next_year) - int(year)
	print(result)
main()


n = int(input())
if n < 10:
	print(1)
else:
	print((int(str(n)[0]) + 1) * 10 ** (len(str(n)) - 1) - n)


anno = input()
if int(anno) <= 9:
	print(1)
else:
	print((int(anno[0]) + 1) * 10 ** (len(anno) - 1) - int(anno))


import math
import re
n = input()
s = len(n)
m = int(n)
print(10 ** (s - 1) - m % 10 ** (s - 1))


n = input()
a = (int(n[0]) + 1) * 10 ** (len(n) - 1)
print(a - int(n))


import sys

def solve():
	n = int(input())
	d = len(str(n))
	nxt_lucky = (n // 10 ** (d - 1) + 1) * 10 ** (d - 1)
	ans = nxt_lucky - n
	print(ans)
solve()


n = int(input())
if n < 10:
	print(1)
else:
	c = 10 ** (len(str(n)) - 1)
	print(c - n % c)


n = input()
a = int(n[0]) + 1
s = int(str(a) + '0' * (len(n) - 1))
print(s - int(n))


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

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

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
curr_year = input()
next_lucky = int(str(int(curr_year[0]) + 1) + '0' * (len(curr_year) - 1)) - int(curr_year)
print(next_lucky)


c = int(input())
for i in range(0, 10):
	for j in range(1, 10):
		ans = j * pow(10, i)
		if c < ans:
			print(ans - c)
			exit()


x = input('')
cont = 0
for i in range(len(x)):
	if int(x[i]) > 0 and i == 0:
		cont = int(x[i]) + 1
	else:
		cont = 10 * cont
print(cont - int(x))


from math import *
a = input()
if len(a) == 1:
	print('1')
	exit(0)
elif len(a) - a.count('0') == 1:
	print(10 ** a.count('0'))
	exit(0)
else:
	b = len(a) - 1
	a = int(a)
	c = a / 10 ** b
	c = ceil(c)
	c *= 10 ** b
	print(c - a)


n = int(input())
k = 1
l = n // 10
while l:
	k *= 10
	l //= 10
print((n // k + 1) * k - n)


x = input()
y = str(int(x[0]) + 1)
while y.__len__() < x.__len__():
	y += '0'
if y[0] < x[0] and y.__len__() == x.__len__():
	y += '0'
print(int(y) - int(x))


m = int(input())
n = list(str(m))
if len(n) == 1:
	print(1)
else:
	a = 10 ** (len(n) - 1) - m % 10 ** (len(n) - 1)
	print(a)


s = input()
print((int(s[0]) + 1) * 10 ** (len(s) - 1) - int(s))


t = input()
l = len(t)
print((int(t[0:1]) + 1) * 10 ** (l - 1) - int(t))


while True:
	s = ''
	try:
		s = input()
	except:
		break
	slen = len(s)
	st = '0'
	if s[0] == '9':
		st = '1'
	else:
		st = chr(ord(s[0]) + 1)
		slen = slen - 1
	nex = int(st + '0' * slen)
	print(nex - int(s))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def check(n):
	n = list(set(list(str(n))))
	if len(n) == 1:
		return True
	n.sort()
	if n[0] == '0':
		if len(n) <= 2:
			return True
		else:
			return False
	else:
		return False
n = I()
n = str(n)
s = len(n)
f = int(n[0])
s = len(n) - 1
f += 1
print(int(str(f) + s * '0') - int(n))


n = int(input().strip())
nh = int(str(int(str(n)[0]) + 1) + '0' * (len(str(n)) - 1))
print(nh - n)


import math
n = int(input())
if n < 10:
	print(1)
	exit(0)
else:
	tmp = str(n)
	size = len(tmp)
	number = (int(tmp[0]) + 1) * 10 ** (size - 1)
	print(number - n)


import math
y = input()
l = len(y)
x = int(y)
if l != 1:
	z = x / 10 ** (l - 1)
else:
	print(1)
	exit(0)
z = math.ceil(z)
z = z * 10 ** (l - 1)
if z == x:
	print(10 ** (l - 1))
	exit(0)
print(z - x)


n = int(input())
l = len(str(n)) - 1
print((int(str(n)[0]) + 1) * 10 ** l - n)


a = input()
b = int(a[0]) + 1
p = b * pow(10, a.__len__() - 1)
print(p - int(a))


cy = input()
l = len(cy)
n = int(cy[0]) + 1
n = str(n)
n += '0' * (l - 1)
w = int(n) - int(cy)
print(w)


n = int(input())
for i in range(0, 11):
	for j in range(1, 10):
		m = j * 10 ** i
		if n < m:
			print(m - n)
			return


s = str(input())
if s[0] == '9':
	ans = '10' + (len(s) - 1) * '0'
else:
	ans = str(int(s[0]) + 1) + (len(s) - 1) * '0'
print(int(ans) - int(s))


n = int(input())
m = n + 1
k = 0
while m != 0:
	m //= 10
	k += 1
for i in range(k + 1):
	for j in range(1, 10):
		if j * 10 ** i > n:
			print(j * 10 ** i - n)
			exit()


def numdig(n):
	c = 0
	while n > 0:
		c += 1
		n = n // 10
	return c

def islucky(n):
	x = numdig(n)
	y = 10 ** x // 10
	i = int(str(n)[0])
	return (i + 1) * y - n
print(islucky(int(input())))


y = input()[1:]
print(10 ** len(y) - int(y or 0))


def solve(n):
	if len(n) == 1:
		return 1
	size_n = len(n)
	if int(n[0]) < 9:
		r = str(int(n[0]) + 1) + '0' * (size_n - 1)
		return int(r) - int(n)
	else:
		r = '1' + '0' * size_n
		return int(r) - int(n)
N = input()
print(solve(N))


t = int(input())
t_t = t
while True:
	if t > 1000000000:
		t += 1
		x = 1
		while t % 1000000000 != 0:
			t = max(x * 1000000000, t)
			x += 1
	elif t > 100000000:
		t += 1
		x = 1
		while t % 100000000 != 0:
			t = max(x * 100000000, t)
			x += 1
	elif t > 10000000:
		t += 1
		x = 1
		while t % 10000000 != 0:
			t = max(x * 10000000, t)
			x += 1
	elif t > 1000000:
		t += 1
		x = 1
		while t % 1000000 != 0:
			t = max(x * 1000000, t)
			x += 1
	elif t > 100000:
		t += 1
		x = 1
		while t % 100000 != 0:
			t = max(x * 100000, t)
			x += 1
	elif t > 10000:
		t += 1
		x = 1
		while t % 10000 != 0:
			t = max(x * 10000, t)
			x += 1
	elif t > 1000:
		t += 1
		x = 1
		while t % 1000 != 0:
			t = max(x * 1000, t)
			x += 1
	elif t > 100:
		t += 1
		x = 1
		while t % 100 != 0:
			t = max(x * 100, t)
			x += 1
	elif t > 10:
		t += 1
		x = 1
		while t % 10 != 0:
			t = max(x * 10, t)
			x += 1
	else:
		t += 1
	x = str(t)
	x = list(x)
	ze = x.count('0')
	if len(x) - ze == 1:
		print(t - t_t)
		break


n = int(input())
j = len(str(n))
if j == 1:
	print(1)
else:
	print((n // 10 ** (j - 1) + 1) * 10 ** (j - 1) - n)


def main():
	s = input()
	n = int(s)
	if n < 10:
		return 1
	m = int(s[0]) + 1
	m *= 10 ** (len(s) - 1)
	return m - int(n)
print(main())


s = input()
if int(s) < 10:
	print(1)
else:
	r = int(s[0]) + 1
	r *= 10 ** (len(s) - 1)
	print(r - int(s))


a = int(input())
if a <= 9:
	print('1')
elif a <= 99:
	print((a // 10 + 1) * 10 - a)
elif a <= 999:
	print((a // 100 + 1) * 100 - a)
elif a <= 9999:
	print((a // 1000 + 1) * 1000 - a)
elif a <= 99999:
	print((a // 10000 + 1) * 10000 - a)
elif a <= 999999:
	print((a // 100000 + 1) * 100000 - a)
elif a <= 9999999:
	print((a // 1000000 + 1) * 1000000 - a)
elif a <= 99999999:
	print((a // 10000000 + 1) * 10000000 - a)
elif a <= 999999999:
	print((a // 100000000 + 1) * 100000000 - a)
elif a <= 9999999999:
	print((a // 1000000000 + 1) * 1000000000 - a)


n = input()
tmp = n
if int(tmp) < 10:
	print(1)
elif int(tmp[0]) < 9:
	tmp = (int(tmp[0]) + 1) * pow(10, len(n) - 1)
	tmp = int(tmp)
	print(tmp - int(n))
else:
	tmp = pow(10, len(n))
	tmp = int(tmp)
	print(tmp - int(n))


from math import *
s = str(input())
num = len(s)
if num == 1:
	print(1)
else:
	new_dig = str(int(s[0]) + 1)
	new_year = int(new_dig + '0' * (num - 1))
	print(new_year - int(s))


n = int(input()) + 1
if n <= 10:
	print(1)
else:
	k = 1
	if n % 10 ** (len(str(n)) - 1) == 0:
		print(1)
		exit()
	for i in range(len(str(n)) - 1):
		k = k * 10
	print(k - n % 10 ** (len(str(n)) - 1) + 1)


def digit_count(x):
	count = 0
	while x > 0:
		count += 1
		x //= 10
	return count
year = input()
wait = int(year[0])
year = int(year)
ans = (wait + 1) * 10 ** (digit_count(year) - 1)
ans -= year
print(ans)


from fractions import gcd
from heapq import *
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
MOD = 10 ** 9 + 7

def main():
	s = input()
	if len(s) == 1:
		print(1)
		exit()
	v = 10 ** (len(s) - 1)
	n = int(s[1:])
	print(v - n)
main()


n = int(input())
t = str(n)
l = len(t)
f = int(t[0])
print((f + 1) * 10 ** (l - 1) - n)


def findLYear(curYear):
	if len(curYear) == 1:
		return 1
	nextZ = str(eval(curYear[0]) + 1) + ''.join(['0'] * len(curYear[1:]))
	return eval(nextZ) - eval(curYear)
inV = input()
print(findLYear(inV))


t = input()
year = list(t)
n = len(year)
first_num = int(year[0])
lucky_year = first_num + 1
for i in range(n - 1):
	lucky_year *= 10
print(lucky_year - int(t))


a = input('')
l = len(a) - 1
x = (int(a[0]) + 1) * 10 ** l
if l == 0:
	print(1)
else:
	print(x - int(a))


n = int(input())
if n < 10:
	print(1)
else:
	tp = str(n)
	l1 = str(int(tp[0]) + 1) + '0' * (len(tp) - 1)
	print(int(l1) - n)


N = int(input())
g = N
h = 1
if N > 9:
	while g > 9:
		g //= 10
		h *= 10
	g += 1
	g *= h
	print(g - N)
else:
	print(1)


print(''.join([str(10 ** (len(n) - 1) - int(n) % 10 ** (len(n) - 1)) for n in [input()]]))


n = input()
l = []
l.append(str(int(n[0]) + 1))
for pos in range(1, len(n)):
	l.append('0')
lucky_no = ''.join(l)
print(int(lucky_no) - int(n))


Input = lambda : map(int, input().split())
n = int(input())
p = len(str(n))
a = n // pow(10, p - 1) + 1
a *= pow(10, p - 1)
print(a - n)


def fun(n):
	ln = len(n)
	tmp = ord(n[0])
	tmp = tmp - 47
	for i in range(ln - 1):
		tmp *= 10
	print(tmp - int(n))
n = input()
fun(n)


__author__ = 'artyom'

def main():
	s = read(0)
	l = 10 ** (len(s) - 1)
	return l - int(s) % l

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s)
write(main())


n = int(input())
s = str(n)
l = len(s)
m = int(s[0]) + 1
m = int(m)
m = m * 10 ** (l - 1)
print(m - n)


def calc(n):
	g = n
	m = 1
	while n >= 10:
		m = m * 10
		n = int(n / 10)
	m = m * (1 + n)
	return m - g
n = int(input())
print(calc(n))


year = input()
print((int(year[0]) + 1) * 10 ** (len(year) - 1) - int(year))


y = input()
l = len(y)
x = l - 1
m = int(y) // 10 ** x
print((m + 1) * 10 ** x - int(y))


import math
a = input()
n = len(a)
print((1 + int(a[0])) * pow(10, n - 1) - int(a))


import math
n = input()
if len(n) == 1:
	print(1)
else:
	result = int(math.pow(10, len(n) - 1))
	result = int(n) / result
	print(abs(int((int(result) + 1) * math.pow(10, len(n) - 1) - int(n))))


s = str(input())
nex = str(int(s[0]) + 1)
for i in range(1, len(s)):
	nex += '0'
print(int(nex) - int(s))


n = int(input())
p = str(n)
a = 10 ** (len(p) - 1)
print(a - n % a)


S = int(input())
d = 10 ** (len(str(S)) - 1)
if S % d == 0:
	print(d)
else:
	print(d - S % d)


x = input('')
a = len(x)
c = 0
if a == 1:
	c = 1
else:
	c = (int(x[0]) + 1) * 10 ** (a - 1)
	c = c - int(x)
print(c)


l = [1]
t = 0
n = int(input())
if n < 10:
	print(1)
	exit()
while l[-1] <= 1000000000:
	for x in range(1, 10):
		l.append(x * 10 ** t)
	t = t + 1
r = l[1:]
p = l[2:] + [0]
e = zip(r, p)
for (a, b) in e:
	if a <= n < b:
		print(b - n)
		exit()


a = input()
n = '9'
if a[0] != n and len(a) == 1:
	l = int(a) + 1
elif a[0] != n:
	l = (int(a[0]) + 1) * 10 ** (len(a) - 1)
else:
	l = l = 1 * 10 ** len(a)
print(l - int(a))


def countNulls(a):
	S = str(a)
	count = 0
	for s in S:
		if s == '0':
			count += 1
	return count

def main():
	y = int(input())
	i = 1
	if len(str(y + 1)) - countNulls(y + 1) != 1:
		i = int(str(y)[0]) + 1
		i = i * 10 ** (len(str(y)) - 1)
		i = i - y
	print(i)
main()


n = input()
if len(n) > 1:
	s = 10 - int(n[-1])
	p = 1
	for i in range(len(n) - 2, 0, -1):
		s += (9 - int(n[i])) * 10 ** p
		p += 1
	print(s)
else:
	print(1)


a = input()
if len(a) == 1:
	print(1)
else:
	p = 1
	for j in range(1, len(a)):
		s = str(9 - int(a[j])) + '0' * (len(a) - 1 - j)
		p += int(s)
	print(p)


n = input()
if len(n) == 1:
	print(1)
else:
	a = int(n[0])
	zeros = ''
	for i in range(len(n) - 1):
		zeros += '0'
	b = (a + 1) * int('1' + zeros)
	difference = b - int(n)
	print(difference)


n = input()
if len(n) == 1:
	print(1)
	exit()
if n[0] == '9':
	print(int('1' + len(n) * '0') - int(n))
else:
	t = str(int(n[0]) + 1) + '0' * (len(n) - 1)
	print(int(t) - int(n))


a = input('')
length = len(a)
b = a
if length == 1:
	print(1)
elif length == 2:
	rem = int(a) % 10
	add = int(10 - rem)
	print(add)
elif length == 3:
	rem1 = int(a) % 10
	b = (int(a) - int(rem1)) / 10
	rem2 = int(b) % 10
	sum = int(rem2) * 10 + rem1
	ans = 100 - int(sum)
	print(ans)
elif length >= 4:
	first = int(a[0]) + 1
	next = int(first) * 10 ** (int(length) - 1)
	ans1 = int(next) - int(a)
	print(ans1)


n = input()
i = len(n) - 1
t = int(n[0]) + 1
print(10 ** i * t - int(n))


def main():
	year = input()
	nextYear = (int(year[0]) + 1) * 10 ** (len(year) - 1)
	print(nextYear - int(year))
main()


def solve(n):
	if n < 10:
		return 1
	a = str(n)
	b = int(a[1:])
	return 10 ** (len(a) - 1) - b
n = int(input())
print(solve(n))


n = input()
if len(n) == 1:
	print(1)
else:
	res = int(n) + 10 ** (len(n) - 1) - int(n) % 10 ** (len(n) - 1)
	print(res - int(n))


n = input()
m = int(n)
if len(n) == 1:
	print(1)
elif n[0] != '9':
	z = str(int(n[0]) + 1)
	for i in range(0, len(n) - 1):
		z += '0'
	x = int(z)
	print(x - m)
else:
	z = str(1)
	for i in range(0, len(n)):
		z += '0'
	x = int(z)
	print(x - m)


n = int(input())
pow_of_10 = len(str(n)) - 1
ten_to_pow = 10 ** pow_of_10
print((n // ten_to_pow + 1) * ten_to_pow - n)


a = input()
t = int(a[0]) + 1
print(int(str(t) + (len(a) - 1) * '0') - int(a))


from sys import exit
n = input()
l = len(n)
if l == 1:
	print('1')
else:
	x = int(n[0]) * 10 ** (l - 1) + 10 ** (l - 1)
	s = x - int(n)
	print(s)


def cnt(x):
	sum = 0
	while x > 0:
		sum += 1
		x //= 10
	return sum
n = int(input())
dig = cnt(n)
lim = 1
for i in range(dig - 1):
	lim *= 10
res = lim
while res <= n:
	res += lim
print(res - n)


x = int(input())
a = x
x += 1
if len(str(x)) - str(x).count('0') <= 1:
	b = x
else:
	b = int(str(int(str(x)[0]) + 1) + '0' * (len(str(x)) - 1))
print(b - a)


n = input()
a = int(n)
b = int(n[0]) + 1
c = int(str(b) + '0' * len(n[1:]))
print(c - a)


n = input()
d = 10 ** (len(n) - 1)
print(d - int(n) % d)


year = input()
next_year = ''
last_digit = int(year[0])
last_digit += 1
next_year += str(last_digit)
for i in range(1, len(year)):
	next_year += str(0)
print(int(next_year) - int(year))


n = input()
y = lambda n: int(str(int(n[0]) + 1) + '0' * (len(n) - 1)) - int(n)
print(y(n) if y(n) > 0 else int(y(n)) + 1)


X = int(input()) + 1
if X <= 10 or str(X).count('0') == len(str(X)) - 1:
	print(1)
	exit()
X = str(X)
print(int(str(int(X[0]) + 1) + '0' * (len(X) - 1)) - int(X) + 1)


def main():
	NUMBERS = [str(i) for i in range(1, 10)]
	num = input()
	result = ''
	if num in NUMBERS:
		result = 1
		return result
	if len(num) == num.count('0') + 1:
		result = int(str(int(num[0]) + 1) + num[1:]) - int(num)
		return result
	result = int(str(int(num[0]) + 1) + (len(num) - 1) * '0') - int(num)
	return result
print(main())


x = input()
l = len(x)
y = int(x)
r = 10 ** (l - 1)
ans = (y // r + 1) * r - y
print(ans)


n = int(input())
if n < 10:
	print(1)
	quit()
s = list(map(int, str(n)))
if s[0] == '9':
	ss = []
	s.append(1)
	for x in s:
		ss.append(0)
	s = ss
else:
	s[0] += 1
	for i in range(1, len(s)):
		s[i] = 0
m = 0
for x in s:
	m *= 10
	m += x
print(m - n)


n = input()
k = int(n[0])
n = int(n)
k = (k + 1) * 10 ** (len(str(n)) - 1)
print(k - n)


n = int(input())
a = n
t = 10
n += 1
while list(str(n)).count('0') + 1 != len(str(n)):
	n += t - n % t
	t *= 10
print(n - a)


n = input()
first = n[:1]
rest = n[1:]
A = int(n)
B = int(str(int(first) + 1) + '0' * len(rest))
print(B - A)


s = input()
num = int(s)
n = len(s)
x = int(s[0])
ans = (x + 1) * 10 ** (n - 1)
print(ans - num)


a = input()
b = str(int(a[0]) + 1) + '0' * (len(a) - 1)
print(int(b) - int(a))


n = int(input())
w = str(n)
l = len(w)
if l == 1:
	print('1')
else:
	k = str(n)
	m = str(int(k[0]) + 1) + (l - 1) * '0'
	j = int(m)
	print(j - n)


n = int(input())
s = 0
add = 1
while add <= n:
	s += 1
	add *= 10
s -= 1
p = 10 ** s
while p <= n:
	p += 10 ** s
print(abs(n - p))


a = input()
num = len(a)
a = int(a)
if num == 1:
	print(1)
else:
	p = a % 10 ** (num - 1)
	if p == 0:
		print(10 ** (num - 1))
	else:
		x = a // 10 ** (num - 1)
		x = x + 1
		print(x * 10 ** (num - 1) - a)


n = int(input())
s = [int(i) for i in str(n)]
if s[0] == 9:
	l = [1] + [0] * len(s)
	print(int(''.join([str(i) for i in l])) - n)
else:
	l = [s[0] + 1] + [0] * (len(s) - 1)
	print(int(''.join([str(i) for i in l])) - n)


import math
n = input()
ln = len(n)
n = int(n)
m = int('1' + '0' * (ln - 1))
nxt = math.ceil((n + 1) / m) * m
print(nxt - n)


s = input()
if len(s) == 1:
	print(1)
else:
	print((int(s[0]) + 1) * pow(10, len(s) - 1) - int(s))


s = input()
ans = int(s)
if s[0] == '9':
	n = 1
	for i in range(len(s)):
		n *= 10
else:
	n = int(s[0])
	n += 1
	for i in range(1, len(s)):
		n *= 10
print(n - ans)


year = input()
if len(year) == 1:
	print(1)
else:
	newyear = '10' + '0' * (len(year) - 1) if year[0] == '9' else str(int(year[0]) + 1) + '0' * (len(year) - 1)
	print(int(newyear) - int(year))


import math
n = int(input())
d = math.floor(math.log(n, 10) + 1)
if d == 1:
	print(1)
else:
	a = str(n)[0]
	a = int(a) + 1
	a = a * 10 ** (d - 1)
	print(a - n)


y = int(input())
a = int(str(y)[0])
next_h = (a + 1) * 10 ** (len(str(y)) - 1)
print(next_h - y)


y = input()
s = len(y) - 1
f = int(y[0])
fn = f + 1
hy = fn * 10 ** s
dfn = hy - int(y)
print(dfn)


a = input()
x = len(a) - 1
print(10 ** x - int(a) % 10 ** x)


def solve(x):
	count = 0
	while x > 0:
		count += 1
		x //= 10
	return count
year = input()
k = int(year[0])
year = int(year)
ans = (k + 1) * 10 ** (solve(year) - 1)
ans -= year
print(ans)


num = input()
print(int(str(int(num[0]) + 1) + ''.join(['0'] * (len(num) - 1))) - int(num))


n = input()
l = [int(i) for i in n]
x = l[0]
x = (x + 1) * pow(10, len(l) - 1)
n = int(n)
print(x - n)


def getDigits(num):
	if num < 10:
		return [num]
	return getDigits(num // 10) + [num % 10]

def main():
	n = int(input())
	digits = getDigits(n)
	digits[0] += 1
	for i in range(1, len(digits)):
		digits[i] = 0
	newNo = ''.join(list(map(str, digits)))
	print(int(newNo) - n)
main()


n = input()
f = int(n[0]) + 1
f = str(f)
b = len(n) - 1
m = int(f + '0' * b)
print(m - int(n))


n = input()
thingo = 10 ** (len(n) - 1)
remainder = int(n) % thingo
print(thingo - remainder)


num1 = int(input())
list = [int(x) for x in str(num1)]
ans = [0 for i in list]
ans[0] = list[0] + 1
num = int(''.join(map(str, ans)))
print(num - num1)


def main():
	s = input()
	n = len(s)
	t = int(str(int(s[0]) + 1) + '0' * (n - 1))
	print(t - int(s))
main()


N = input()
print((int(N[0]) + 1) * 10 ** (len(N) - 1) - int(N))


a = input()
b = '1'
for i in range(len(a[1:])):
	b += '0'
if len(a) == 1:
	print(1)
else:
	print(int(b) - int(a[1:]))


a = input()
b = a.__len__()
c = int(a[0])
num = (c + 1) * 10 ** (b - 1)
print(num - int(a))


n = int(input())
cnt = 0
t = n
while n >= 10:
	n = int(n / 10)
	cnt += 1
n += 1
n *= pow(10, cnt)
print(n - t)


n = input()
nex = (int(n[0]) + 1) * 10 ** (len(n) - 1)
print(nex - int(n))


n = input()
if n[0] != '9':
	print(int(str(int(n[0]) + 1) + '0' * (len(n) - 1)) - int(n))
else:
	print(int('1' + '0' * len(n)) - int(n))


year = input()
raz = len(year)
next_year = (int(year[0]) + 1) * 10 ** (raz - 1)
print(next_year - int(year))


n = int(input())
x = str(n)
if len(x) == 1:
	print(1)
else:
	s = x[1:]
	l = len(s)
	res = 1
	while l != 0:
		res *= 10
		l -= 1
	print(res - int(s))


import math
n = int(input())
p10 = int(math.log10(n + 1))
p = pow(10, p10)
years = (int(n / p) + 1) * p - n
print(years)


import math
number = input()
contador = 0
for i in number:
	if i != '0':
		contador += 1
numberint = int(number)
y = 1
if contador > 1:
	while numberint / y > 10:
		y = y * 10
	resultado = math.ceil(numberint / y) * y - numberint
	print('{:d}'.format(resultado))
if contador < 2:
	if numberint < 10:
		print(1)
	else:
		while numberint / y > 9:
			y = y * 10
		print('{:d}'.format(y))


import math
n = int(input())
a = 10 ** int(math.log10(n))
print(abs(n % a - a))


n = input()
print(int(str(int(n[0]) + 1) + '0' * (len(n) - 1)) - int(n))


n = int(input())
l = []
mul = 1
for i in range(11):
	for j in range(1, 10):
		l.append(j * mul)
	mul *= 10
for i in l:
	if i > n:
		print(i - n)
		break


import math
n = int(input())
ans = 0
if n < 10:
	print(1)
	exit()
m = len(str(n)) - 1
s = math.ceil(n / 10 ** m)
if s * 10 ** m - n == 0:
	s = math.ceil((n + 1) / 10 ** m)
	print(s * 10 ** m - n)
else:
	print(s * 10 ** m - n)


s = input()
x = int(s)
y = int(str(int(s[0]) + 1) + '0' * (len(s) - 1))
print(y - x)


while True:
	try:
		ans = 1
		n = int(input())
		m = n
		while m >= 10:
			ans *= 10
			m //= 10
		ans *= m % 10 + 1
		print(ans - n)
	except EOFError:
		break


n = int(input())
i = 1
cur = n
x = 1
while cur > 0:
	a = cur % 10
	cur //= 10
	x *= 10
print((a + 1) * x // 10 - n)


n = int(input())

def happy(n):
	numbers = [0] * 10
	while n != 0:
		mod = n % 10
		numbers[mod] += 1
		n //= 10
	count = 0
	for i in range(1, 10):
		if numbers[i] > 0:
			count += numbers[i]
			if count > 1:
				return False
				break
	return True

def isHappy(n):
	if len(str(n)) == 1:
		return 1
	if happy(n) == True:
		return 10 ** (len(str(n)) - 1)
	else:
		return 10 ** (len(str(n)) - 1) - n % 10 ** (len(str(n)) - 1)
print(isHappy(n))


n = int(input())
c = 0
while n >= 10 ** (c + 1):
	c += 1
print((n // 10 ** c + 1) * 10 ** c - n)


n = input()
num = str(int(n[0]) + 1) + str(10 ** (len(n) - 1))[1:]
print(int(num) - int(n))


yrs = input()
nyri = int(yrs[0]) + 1
nyr = nyri * 10 ** (len(yrs) - 1)
yr = int(yrs)
lt = nyr - yr
print(lt)


cur = int(input())
d = 1
while cur // d > 0:
	d *= 10
d //= 10
cw = (cur // d + 1) * d
print(cw - cur)


n = int(input())
sep = 1
for i in range(1, 9):
	if sep == n:
		break
	if sep > n:
		sep /= 10
		break
	sep *= 10
xx = 0
for i in range(1, 11):
	xx += sep
	if xx > n:
		break
if xx == n:
	print(xx, end='\n')
else:
	print(int(xx - n), end='\n')


import sys
line = input()
print(pow(10, len(line) - 1) * (int(line[0]) + 1) - int(line))


import math
year = int(input())
if year < 1 or year > math.pow(10, 9):
	exit()
year = list(str(year))
if len(year) == 1:
	print(1)
else:
	temp = int(year[0]) + 1
	temp = temp * 10 ** (len(year) - 1)
	print(temp - int(''.join(year)))


import math
a = int(input())
b = int(10 ** (math.log(a + 1) // math.log(10)))
total = b
while total <= a:
	total += b
print(str(total - a))


in_str = input()
x = (int(in_str[0]) + 1) * 10 ** (len(in_str) - 1)
print(x - int(in_str))


a = int(input())
c = a
b = len(str(a))
i = 0
while a % 10 == 0:
	a = a // 10
	i += 1
if a > 0 and a <= 9:
	print(10 ** i)
else:
	print(10 ** (b - 1) - c % 10 ** (b - 1))


def lucky_year():
	year = int(input())
	if year < 10:
		return 1
	temp = str(year)
	lucky = ''
	lucky = lucky + str(int(temp[0]) + 1)
	for i in range(len(temp) - 1):
		lucky = lucky + '0'
	return int(lucky) - year
A = lucky_year()
print(A)


k = list(input())
n = int(''.join(k))
m = len(k) - 1
i = 0
ans = 0
if n % 10 ** m == 0:
	print(10 ** m)
else:
	while n // 10 != 0:
		if n % 10 == 0:
			n //= 10
		else:
			ans += 10 ** i * (10 - n % 10)
			n //= 10
			n += 1
		i += 1
	print(int(ans))


s = input()
n = int(s)
if n < 10:
	print(1)
else:
	k = n // 10 ** (len(s) - 1)
	k += 1
	k = k * 10 ** (len(s) - 1)
	print(k - n)


n = input()
k = ''
k = '1' + '0' * (len(n) - 1)
k = int(k)
l = n[0] + '0' * (len(n) - 1)
l = int(n) % int(l)
k -= l
print(k)


n = input()
s = len(n)
if s == 1:
	print(1)
else:
	p = int(n[0]) + 1
	t = p * 10 ** (s - 1)
	print(t - int(n))


year = str(input())
nextYear = []
nextYear.append(str(int(year[0]) + 1))
for char in year[1:]:
	nextYear.append('0')
nextYear = ''.join(nextYear)
print(int(nextYear) - int(year))


a = int(input())
b = a
nr = 1
while b > 9:
	nr *= 10
	b /= 10
print(int(b + 1) * int(nr) - int(a))


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
from math import ceil
n = I()
x = str(n)
if n < 10:
	print(1)
else:
	p = len(x)
	f = n // pow(10, p - 1) + 1
	num = f * pow(10, p - 1)
	print(num - n)


x = input()
ten = '1' + '0' * (len(x) - 1)
if len(x) == 1:
	exit(print(1))
else:
	x = int(x)
	ten = int(ten)
	near = (int(x / ten) + 1) * ten
	print(near - x)


n = input()
temp = len(n)
a = int(n[0]) + 1
ans = int(a) * 10 ** (temp - 1) - int(n)
print(ans)


def happy_year(s):
	if s[0] == '9':
		return 10 * 10 ** (len(s) - 1) - int(s)
	return (int(s[0]) + 1) * 10 ** (len(s) - 1) - int(s)
print(happy_year(input()))


n = int(input())
if n / 10 == 0:
	print(1)
else:
	l = int(len(str(n)))
	n = int(n)
	q = int(n / 10 ** (l - 1))
	ans = (q + 1) * 10 ** (l - 1) - n
	print(int(ans))


n = int(input())
if n <= 9:
	print(1)
elif n % 10 != 0:
	print((n // 10 ** (len(str(n)) - 1) + 1) * 10 ** (len(str(n)) - 1) - n)
else:
	print((n // 10 ** (len(str(n)) - 1) + 1) * 10 ** (len(str(n)) - 1) - n)


p = int(input())
v = p
h = 0
g = False
for i in range(len(str(p))):
	if v % 10 != 0:
		h += 1
	if h > 1:
		g = True
		break
	v = int(v // 10)
v = p
if g == False and p <= 10:
	if p < 10:
		print(1)
	if p == 10:
		print(20 - p)
else:
	v = v // 10 ** (int(len(str(p))) - 1)
	v += 1
	v *= 10 ** (int(len(str(p))) - 1)
	print(v - p)


y = int(input())
ans = 1
t = str(y)
if len(t) == 1:
	print(ans)
else:
	m = int(t[0]) + 1
	for i in range(len(t) - 1):
		m *= 10
	print(m - y)


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
n = ii()
s = str(n)
l = len(s)
s = str(int(s[0]) + 1) + '0' * (l - 1)
print(int(s) - n)


num1 = input()
list = [int(x) for x in num1]
num1 = int(num1)
ans = []
for i in range(len(list)):
	ans.append(0)
if len(list) == 1:
	print(1)
else:
	ans[0] = list[0] + 1
	num = int(''.join(map(str, ans)))
	print(num - num1)


n = int(input())
e = len(str(n))
res = (n // 10 ** (e - 1) + 1) * 10 ** (e - 1) - n
print(res)


year = input().strip()
l = len(year) - 1
year = int(year)
if year < 10:
	print(1)
else:
	print(10 ** l - year % 10 ** l)


n = int(input())
s = str(n)
f = s[0]
next = (int(f) + 1) * 10 ** (len(s) - 1)
print(next - n)


def Task(n):
	length = len(n)
	start = int(n[0])
	n = int(n)
	if length == 1:
		res = 1
	else:
		res = (start + 1) * 10 ** (length - 1) - n
	return res

def Main():
	inp = input()
	outp = Task(inp)
	print(outp)

def Test():
	assert Task('4') == 1
	assert Task('901') == 99
	print('Tests done')
Main()


n = int(input())
length = len(str(n))
first_digit = str(n)[0]
lucky_year = (int(first_digit) + 1) * pow(10, length - 1)
print(int(lucky_year - n))


n = int(input())
s = str(n)
if len(s) == 1:
	print('1')
else:
	t = str(int(s[0]) + 1) + '0' * (len(s) - 1)
	print(int(t) - n)


n = list(input())
if len(n) == 1:
	print(1)
else:
	x = '1'
	n.pop(0)
	x += '0' * len(n)
	z = ''.join(n)
	print(int(x) - int(z))


year = int(input())
order = 1
temp = year
while temp != 0:
	temp = int(temp / 10)
	if temp is not 0:
		order = order * 10
temp = year % order
print(order - temp)


n_init = input()
length = len(n_init)
s = int(n_init[0])
n_final = str(s + 1) + '0' * (length - 1)
print(int(n_final) - int(n_init))


s = input()
k = int(s[0]) + 1
n = len(s) - 1
k *= 10 ** n
print(k - int(s))


n = int(input())
x = 1
b = 1
while True:
	if x * b > n:
		print(x * b - n)
		exit(0)
	if x < 9:
		x += 1
	else:
		x = 1
		b *= 10


def main():
	n = int(input()) + 1
	nstr = str(n)[1:]
	if not nstr:
		print(1)
		return
	wf = int(nstr)
	if wf == 0:
		print(1)
	else:
		nxt = int('1' + '0' * len(nstr))
		print(nxt - wf + 1)
main()


yi = input()
ko = []
if len(yi) == 1:
	print(1)
else:
	l = len(yi)
	ko += str(int(yi[0]) + 1)
	ko += (l - 1) * '0'
	diff = int(''.join(ko)) - int(yi)
	print(diff)


n = input().strip()
l = len(n)
if l == 1:
	print(1)
else:
	print(10 ** (l - 1) - int(n[1:]))


n = input()[1:]
print(10 ** len(n) - int(n or 0))


n = input()
a = len(n)
b = 10 ** (a - 1)
n = int(n)
print((n // b + 1) * b - n)


n = input()
res = str(int(n[0]) + 1)
for i in range(0, len(n) - 1):
	res += '0'
print(int(res) - int(n))


n = int(input())
if n < 5:
	print(1)
else:
	n_str = str(n)
	nums = list(n_str)
	nums[0] = str(int(nums[0]) + 1)
	for i in range(1, len(nums)):
		nums[i] = '0'
	n_str = ''
	for i in nums:
		n_str += i
	print(int(n_str) - n)


n = int(input())
anst = 1
nn = n
while nn >= 10:
	nn //= 10
	anst *= 10
print((nn + 1) * anst - n)


n = int(input())
i = 0
if n < 10:
	print(1)
else:
	s = str(n)
	print(int(str(int(s[0]) + 1) + '0' * (len(s) - 1)) - n)


n = int(input())
lucky = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 10):
	for j in range(9):
		lucky.append(lucky[j] * 10 ** i)
i = 0
while lucky[i] <= n:
	i += 1
print(lucky[i] - n)


import sys
numero = int(input())
l = str(numero)
casas = len(l) - 1
proximo = int(l[0]) + 1
for i in range(casas):
	proximo = proximo * 10
dif = proximo - numero
print(dif)


n = input()
x = 10 ** (len(n) - 1)
print(x - int(n) % x)


x = input()
n = int(x)
ln = len(x)
y = int(x[0])
y += 1
y = y * 10 ** (ln - 1)
print(y - n)


def checkNum(n):
	nonzeros = 0
	for i in str(n):
		if i != '0':
			nonzeros += 1
	if nonzeros <= 1:
		return True
	else:
		return False

def nextNum(n):
	length = len(str(n))
	first = int(str(n)[0])
	first += 1
	last = str(first)
	for i in range(length - 1):
		last += '0'
	full = int(last) - int(n)
	return full
print(nextNum(int(input())))


def main():
	n = input()
	d = int(n[0])
	if d < 9:
		year = int(str(d + 1) + '0' * (len(n) - 1))
	else:
		year = int('1' + '0' * len(n))
	print(year - int(n))

def __starting_point():
	main()
__starting_point()


n = input()
l = len(n)
if l == 1:
	print('1')
else:
	i = 0
	while n[i] == '0':
		i += 1
	r = str(int(n[i]) + 1)
	for i in range(0, l - i - 1):
		r = r + '0'
	print(int(r) - int(n))


n = int(input())
if n >= 0 and n <= 9:
	print(1)
	exit()
s = str(n)
c = len(s)
tt = 10 ** (c - 1)
yy = tt * (n // tt) + tt
print(yy - n)


num = int(input())
temp = num
count = 0
while temp:
	count += 1
	temp = temp // 10
powr = 1
for i in range(count - 1):
	powr = powr * 10
i1 = num // powr
lucky = (i1 + 1) * powr
print(lucky - num)


n = int(input())
if n <= 9:
	print(1)
else:
	y = len(str(n))
	p = str(n)
	z = p[1:]
	z = int(z)
	x = 10 ** (y - 1)
	print(x - z)


def find_next(number):
	if len(number) == 1:
		return int(number) + 1
	first = str(int(number[0]) + 1)
	output = first
	for x in range(0, len(str(number)) - 1):
		output += '0'
	return output
number = input()
output = int(find_next(number)) - int(number)
print(output)


n = input()
if len(n) == 1:
	print(1)
else:
	n = int(n)
	z = len(str(n)) - 1
	print(10 ** z - n % 10 ** z)


n = input('')
x = list(n)
for i in range(len(x)):
	if i == 0:
		x[i] = str(int(x[i]) + 1)
	else:
		x[i] = '0'
y = ''.join(x)
print(int(y) - int(n))


n = input()
num = int(n)
if num < 10:
	print(1)
else:
	k = (int(n[0]) + 1) * 10 ** (len(n) - 1)
	print(k - num)


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

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def ptlist(l):
	print(' '.join([str(x) for x in l]))
n = it()
k = len(str(n)) - 1
pt((int(str(n)[0]) + 1) * 10 ** k - n)


import math, sys
from fractions import *

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

def main():
	n = int(input())
	lg = len(str(n))
	x = n + 10 ** (lg - 1)
	m = str(x)[0] + '0' * (len(str(x)) - 1)
	print(int(m) - n)
deb = 0
if deb:
	file = open('input.txt', 'w')
else:
	input = sys.stdin.readline
main()


n = int(input())
a = n
k = 0
z = []
m = 0
while a > 0:
	k += 1
	y = a % 10
	a = a // 10
	if y > 0:
		m += 1
x = n
if m == 1:
	print(10 ** (k - 1))
elif m == 0:
	print(1)
else:
	x = n
	for i in range(k - 1):
		x = x // 10
	print(10 ** (k - 1) * (x + 1) - n)


n = int(input())
s = str(n)
r = int(s[0]) + 1
ss = str(r) + '0' * (len(s) - 1)
ss = int(ss)
print(ss - n)


x = input()
a = 10 ** (len(x) - 1)
if int(x) < 10:
	print(1)
else:
	print(a - int(x[1:]))


n = int(input())
if n < 10:
	answer = 1
else:
	current_yar = str(n)
	next_year = int(str(int(current_yar[0]) + 1) + '0' * (len(current_yar) - 1))
	answer = next_year - n
print(answer)


x = input()
if int(x) < 10:
	print(1)
elif int(x) % 10 ** len(x) == 0:
	print(x)
else:
	l = len(x)
	x = int(x)
	s = 10 ** (l - 1) - x % 10 ** (l - 1)
	print(s)


n = input()
r = 10 ** (len(n) - 1)
print(r - int(n) % r)


number = input()

def lucky(n):
	if sum((1 for x in n if x != '0')) > 1:
		return False
	else:
		return True

def next_lucky(n):
	end = (len(n) - 1) * '0'
	nxt = str(int(n[0]) + 1) + end
	return int(nxt) - int(n)
print(next_lucky(number))


n = input()
y = int(n)
if y < 10:
	print(1)
else:
	l = len(n)
	f = int(n[0]) + 1
	f *= 10 ** (l - 1)
	print(f - y)


n = int(input()) + 1
import collections
if collections.Counter(str(n))['0'] + 1 == len(str(n)):
	print(1)
else:
	next_number = int(str(int(str(n)[0]) + 1) + '0' * (len(str(n)) - 1))
	print(next_number - n + 1)


a = input()
b = int(a)
if len(a) == 1:
	print('1')
elif len(a) > 1:
	print((b // 10 ** (len(a) - 1) + 1) * 10 ** (len(a) - 1) - b)


num = input()
adder = (int(num[0]) + 1) * 10 ** (len(num) - 1)
print(adder - int(num))


import sys, math
Tests = 1
for _ in range(Tests):
	s = input()
	if len(s) == 1:
		print(1)
	else:
		t = str(int(s[0]) + 1)
		t += '0' * (len(s) - 1)
		t = int(t)
		print(t - int(s))


import math
n = input()
n = int(n)
i = 9
while True:
	if n % math.pow(10, i) != n:
		k = int(n / math.pow(10, i)) + 1
		print(int(k * math.pow(10, i) - n))
		break
	i = i - 1


def no_of_digits(n):
	return 0 if n == 0 else no_of_digits(n // 10) + 1

def solve(YYYY):
	n = no_of_digits(YYYY)
	p = n - 1
	nxt_lucky_yr = (YYYY // 10 ** p + 1) * 10 ** p
	print(nxt_lucky_yr - YYYY)

def main():
	YYYY = int(input())
	solve(YYYY)
main()


s = list(map(int, reversed(input())))
(cnt, r) = (0, 1)
s.append(0)
changed = False
for (k, v) in enumerate(s):
	if k >= len(s) - 2:
		break
	if v != 0:
		cnt += r * (10 - v)
		s[k + 1] += 1
		changed = True
	r *= 10
if not changed:
	cnt += r
print(cnt)


s = input()
print(int(str(int(s[0]) + 1) + '0' * len(s[1:])) - int(s))


year = int(input())
a = str(year)[0]
nex = (int(a) + 1) * 10 ** (len(str(year)) - 1)
print(nex - year)


n = input()
list = []
j = str(int(n[0]) + 1)
list.append(j)
if len(n) > 1:
	for _ in range(len(n) - 1):
		list.append('0')
print(int(''.join(list)) - int(n))


import sys
input = sys.stdin.readline
n = int(input())
nxt = n
e = 0
while nxt >= 10:
	nxt //= 10
	e += 1
nxt += 1
print(nxt * 10 ** e - n)


n = int(input())
ans = 0
prev = 0
N = n
while n:
	a = n % 10
	n //= 10
	ans += 1
	prev = a
if ans == 1:
	print(1)
else:
	print((prev + 1) * 10 ** (ans - 1) - N)


n = str(input())
l = len(n)
n = int(n)
a = (n // 10 ** (l - 1) + 1) * 10 ** (l - 1)
print(a - n)


n = int(input())
temp = n
cnt = 0
while temp > 0:
	temp = temp // 10
	cnt += 1
if cnt == 1:
	print(1)
else:
	cal = (n // 10 ** (cnt - 1) + 1) * 10 ** (cnt - 1)
	print(cal - n)


n = input()
dd = len(n) - 1
nextLuckyYear = str(int(n[0]) + 1) + '0' * dd
print(int(nextLuckyYear) - int(n))


a = input()
l = len(a)
if l != 1:
	b = 10 ** (l - 1)
	print(b - int(a[1:]))
else:
	print(1)


n = int(input())
c = int(str(n)[0])
print((c + 1) * 10 ** (len(str(n)) - 1) - n)


n = input()
if len(n) == 1:
	print(1)
else:
	t = n[0] + (len(n) - 1) * '0'
	t = int(t)
	y = '1' + (len(n) - 1) * '0'
	y = int(y)
	t = t + y
	print(t - int(n))


def solve():
	n = int(input())
	ans = n
	ok = 1
	la = 0
	while n:
		if n % 10:
			la = n % 10
		ok *= 10
		n //= 10
	la += 1
	ans = la * ok // 10 - ans
	print(ans)
solve()


s = input()
if len(s) == 1:
	print(1)
else:
	print(10 ** (len(s) - 1) - int(s[1:]))


import sys
Input = sys.stdin.readline
x = input()
L = len(x)
if L == 1:
	print(1)
else:
	tmp = int(x[0]) + 1
	tmp2 = 10 ** (L - 1)
	print(tmp2 * tmp - int(x))


t = input()
final = str(int(t[0]) + 1)
for i in range(len(t) - 1):
	final += '0'
ans = int(final)
print(ans - int(t))


n = input()
a = int(n)
l = len(n)
x = a // 10 ** (l - 1)
print(10 ** (l - 1) * (x + 1) - a)


import sys, math, queue
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
nx = 1
nc = n
while nc >= 10:
	nx *= 10
	nc //= 10
nx *= nc + 1
print(nx - n)


li = []

def pre_build():
	for i in range(10):
		for j in range(10):
			li.append(i * 10 ** j)
	li.sort()

def main():
	year = int(input())
	_len_ = len(li)
	for x in range(len(li)):
		if year >= li[x] and year < li[x + 1]:
			print(li[x + 1] - year)
			break
pre_build()
main()


import sys

def solve():
	n = input()
	ans = str(int(n[0]) + 1) + '0' * (len(n) - 1)
	ans = int(ans) - int(n)
	print(ans)
solve()


year = int(input())
if year < 10:
	print(1)
else:
	x = str(year)
	ny = (int(x[0]) + 1) * 10 ** (len(x) - 1)
	print(ny - year)


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	tmp = 1
	while tmp * 10 <= n:
		tmp *= 10
	ans = n // tmp * tmp + tmp - n
	print(ans)
main()


i = list(input())
g = str(int(i[0]) + 1) + ''.join([str(elem) for elem in [0] * (len(i) - 1)])
print(int(g) - int(''.join([str(elem) for elem in i])))


def next(n):
	p = int(n[0]) + 1
	p = str(p) + len(n[1:]) * '0'
	return int(p) - int(n)
print(next(input()))


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
n = int(input())
p = int(math.log(n, 10)) + 1
s = list(map(int, list(str(n))))
if p == 1:
	print(1)
else:
	x = s[0] + 1
	print(x * pow(10, p - 1) - n)


n = input()
L = len(n)
n = int(n)
print((n // 10 ** (L - 1) + 1) * 10 ** (L - 1) - n)


strn = input()
length = len(strn)
n = int(strn)
wait = 0
if length == 1:
	wait = 1
else:
	firstdigit = int(strn[0])
	firstdigit = firstdigit + 1
	multiplier = 10 ** (length - 1)
	subfrom = firstdigit * multiplier
	wait = subfrom - n
print(wait)


import math
n = int(input())
x = 10 ** math.floor(math.log(n, 10))
print(x - n % x)


a = int(input())
n = len(str(a))
res = (a // 10 ** (n - 1) + 1) * 10 ** (n - 1) - a
print(res)


n = input()
c = 10 ** (len(n) - 1)
print(c - int(n) % c)


c = int(input())
g = c

def check(n):
	s = 0
	while n > 0:
		a = n % 10
		if a != 0:
			s = s + 1
		n = n // 10
	if s <= 1:
		return 1
	else:
		return 0
num = 0
while c > 0:
	num = num + 1
	c = c // 10
un = g // pow(10, num - 1)
print((un + 1) * pow(10, num - 1) - g)


k = list(input())
liczba = 0
kint = 0
liczba2 = 0
for i in range(len(k)):
	if int(k[i]) != 0:
		liczba += 1
k.reverse()
for i in range(len(k)):
	kint += int(k[i]) * 10 ** i
if liczba == 1:
	print(1 * 10 ** (len(k) - 1))
else:
	liczba2 = int(kint / 10 ** (len(k) - 1)) * 10 ** (len(k) - 1) + 10 ** (len(k) - 1)
	print(liczba2 - kint)


import sys, math
n = int(input())
digit = len(str(n)) - 1
if digit == 0:
	print('1')
else:
	p = math.pow(10, digit)
	res = (int(n / p) + 1) * p - n
	print(int(res))


import math
n = int(input())
cnt = 0
a = n
while a > 0:
	x = a % 10
	cnt = cnt + 1
	a = a // 10
z = int(math.pow(10, cnt - 1))
val = n % z
ans = n - val + int(math.pow(10, cnt - 1))
print(ans - n)


from math import ceil
n = input()
dd = len(n) - 1
nextLuckyYear = ceil((int(n) + 1) / 10 ** dd) * 10 ** dd
print(nextLuckyYear - int(n))


x = input()
l = len(x)
y = x[0]
z = int(y) + 1
a = str(z) + '0' * (l - 1)
print(int(a) - int(x))


x = input()
y = (int(x[0]) + 1) * 10 ** (len(x) - 1)
print(y - int(x))


n = int(input())
if len(str(n)) == 1:
	print(1)
else:
	c = '{:<0{}d}'.format(1, int(len(str(n))))
	c = int(c)
	print(c + n - n % c - n)


n = int(input())
temp = n
log = 0
while temp // 10 > 0:
	temp //= 10
	log += 1
large = 10 ** log
luck = n // large * large + large
print(luck - n)


i = int(input())
cnt = 0
j = i
while j > 9:
	j = j / 10
	cnt = cnt + 1
k = i % 10 ** cnt
i = 10 ** cnt - k
print(i)


year = str(input())
end = (int(year[0]) + 1) * 10 ** (len(year) - 1)
print(end - int(year))


n = input()
pow_10 = len(n) - 1
n = int(n)
next_num = 10 ** pow_10 * (n // 10 ** pow_10 + 1)
delta = next_num - n
print(delta)


n = input()
log = len(n) - 1
large = 10 ** log
luck = int(n) // large * large + large
print(luck - int(n))


def luckyYear():
	n = int(input())
	original = n
	p = -1
	f = 0
	while n > 0:
		f = n % 10
		n //= 10
		p += 1
	f += 1
	f *= 10 ** p
	print(f - original)
luckyYear()


n = int(input())
if n < 10:
	print(1)
else:
	m = str(n)
	s = m[1:]
	print(10 ** len(s) - int(s))


current = str(input())
nexti = ''
current = current[::-1]
carry = False
for n in current[:len(current) - 1]:
	if carry:
		nexti += str(10 - int(n) - 1)
	elif int(n) == 0:
		nexti += str(0)
	else:
		nexti += str(10 - int(n))
		carry = True
if not carry:
	nexti += str(1)
nexti = nexti[::-1]
print(int(nexti))


n = input()
p = n[0]
p = int(p)
a = len(n)
if p == 9:
	x = 10 ** a
	print(x - int(n))
else:
	v = 10 ** (a - 1)
	g = str(p + 1) + str(v)[1:]
	print(int(g) - int(n))


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def lucky(n):
	old_year = n
	year = 0
	counts = -1
	if n < 10:
		return 1
	else:
		while n > 0:
			counts += 1
			r = n % 10
			n = n // 10
		year = (r + 1) * 10 ** counts
		return year - old_year
n = inp()
print(lucky(n))


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

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

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
s = input()
ls = len(s)
if s[0] == '9':
	print(10 ** ls - int(s))
else:
	print((int(s[0]) + 1) * 10 ** (ls - 1) - int(s))


import sys
import math
n = int(input())
s = n
r = 1
while n // 10 != 0:
	n = n // 10
	r *= 10
next = (s // r + 1) * r
print(next - s)


n = int(input())
num = n
k = 0
while n > 0:
	k += 1
	n = n // 10
print(pow(10, k - 1) - num % pow(10, k - 1))


n = input()
t = len(str(n))
s = str(int(n[0]) + 1)
s += '0' * (t - 1)
print(int(s) - int(n))


import math
year = int(input())
if year == 999999999:
	print(1)
elif year == 9999999:
	print(1)
else:
	print(math.ceil(year / 10 ** (len(str(year)) - 1) + 0.0001) * 10 ** (len(str(year)) - 1) - year)


n = int(input())
z = 1
for i in range(10):
	if int(n / z) == 0:
		break
	else:
		z *= 10
z /= 10
print(int((int(n / z) + 1) * z - n))


n = int(input())
size = len(str(n))
num = str(n)[0]
res = (int(num) + 1) * 10 ** (size - 1) - n
print(res)


import sys
import math
n = int(input())
if n < 10:
	print(1)
	sys.exit(0)
n_digits = math.floor(math.log10(n)) + 1
base = 10 ** (n_digits - 1)
for i in range(2, 11):
	if base * i > n:
		print(base * i - n)
		sys.exit(0)


n = input()
if len(n) - n.count('0') == 1:
	ans = '1' + '0' * n.count('0')
else:
	ans = 10 ** (len(n) - 1) - int(n[1:])
print(ans)


n = int(input())

def get_lead_digit(n):
	num_digits = 0
	while n // 10 != 0:
		num_digits += 1
		n //= 10
	return [n, num_digits]
Ldigit_Numdigits = get_lead_digit(n)
Ldigit = Ldigit_Numdigits[0]
Num_digits = Ldigit_Numdigits[1]
Ldigit += 1
NextRoundNum = Ldigit * pow(10, Num_digits)
print(NextRoundNum - n)


n = input()
s = ''
for i in range(len(n)):
	if i == 0:
		s += str(int(n[i]) + 1)
	else:
		s += '0'
print(int(s) - int(n))


import sys
s = int(input())
t = 10 ** (len(str(s)) - 1)
print(-(s % t) + t)


def main2(n):
	length = len(str(n))
	finalNum = str(int(str(n)[0]) + 1)
	for i in range(length - 1):
		finalNum += '0'
	full = int(finalNum) - int(n)
	return full
print(main2(int(input())))


n = int(input())
if n < 9:
	print(1)
else:
	g = n
	k = 1
	while g > 9:
		g //= 10
		k *= 10
	print((g + 1) * k - n)


a = list(input())
b = int(''.join(a))
a[0] = str(int(a[0]) + 1)
print(int(a[0] + '0' * (len(a) - 1)) - b)


num = input()
res = int(str(int(num[0]) + 1) + '0' * (len(num) - 1)) - int(num)
print(res)


li = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 20, 200, 2000, 20000, 200000, 2000000, 20000000, 200000000, 2000000000, 30, 300, 3000, 30000, 300000, 3000000, 30000000, 300000000, 3000000000, 40, 400, 4000, 40000, 400000, 4000000, 40000000, 400000000, 4000000000, 50, 500, 5000, 50000, 500000, 5000000, 50000000, 500000000, 5000000000, 60, 600, 6000, 60000, 600000, 6000000, 60000000, 600000000, 6000000000, 70, 700, 7000, 70000, 700000, 7000000, 70000000, 700000000, 7000000000, 80, 800, 8000, 80000, 800000, 8000000, 80000000, 800000000, 8000000000, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000, 9000000000]
li.sort()
y = int(input())
if y < 9:
	print(1)
else:
	for x in range(len(li)):
		if y >= li[x] and y < li[x + 1]:
			print(li[x + 1] - y)
			break


n = int(input())
N = len(str(n))
first = str(n)[0]
L = [str(int(first) + 1)] + ['0'] * (N - 1)
Next = int(''.join(L))
print(Next - n)


a = 0
a = input()
b = 0
b = len(a)
b = b - 1
a1 = 0
ans = 0
a1 = int(a[0])
a1 = a1 + 1
a = int(a)
a1 = a1 * 10 ** b
ans = a1 - a
print(ans)


y = input()
ly = len(y)
iy = int(y)
td = iy / 10 ** (ly - 1)
if td == 9:
	print(10 ** ly - iy)
else:
	print((int(y[0]) + 1) * 10 ** (ly - 1) - iy)


import sys
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(sys.stdin.readline())
writeln = lambda x: sys.stdout.write(str(x) + '\n')
write = lambda x: sys.stdout.write(x)

def solve(n):
	if n < 10:
		return 1
	nums = []
	jarisu = 0
	q = n
	while q:
		(q, r) = divmod(q, 10)
		nums.append(r)
		jarisu += 1
	nine = True if nums[-1] == 9 else False
	if nine:
		return 10 ** jarisu - n
	return (nums[-1] + 1) * 10 ** (jarisu - 1) - n
N = readi()
writeln(solve(N))


import sys
import os
import math
n = int(input())
if n < 10:
	print(1)
else:
	s = str(n)
	l = len(s)
	v = 10 ** (l - 1)
	w = int(s[1:])
	print(v - w)


n = input()
cur = int(n[0])
pre = str(cur + 1)
next = pre + '0' * (len(n) - 1)
print(int(next) - int(n))


n = int(input())
s = str(n)
n2 = int(str(int(s[0]) + 1) + '0' * (len(s) - 1))
print(n2 - n)