Ayush is learning how to decrease a number by one, but he does it wrong with a number consisting of two or more digits. Ayush subtracts one from a number by the following algorithm:
if the last digit of the number is non-zero, he decreases the number by one.
if the last digit of the number is zero, he divides the number by 10.
You are given an integer number n
Ayush will subtract one from it k times. Your task is to print the result after all k subtractions.
It is guaranteed that the result will be a positive integer number.
Input
The first line of the input contains two integers n and k (2 ≤ n ≤ 10^9, 1 ≤ k ≤ 50) -- the number from which Ayush will subtract and the number of subtractions respectively.
Output
Print one integer number — the result of the decreasing n by one k times.
It is guaranteed that the result will be a positive integer number.
EXAMPLE
Sample Input 1
512 4
Sample Output 1
50
Sample Input 2
1000000000 9
Sample Output 2
1

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
try:
	(n, k) = list(map(int, input().split()))
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n -= 1
	print(int(n))
except:
	pass


(n, k) = map(int, input().split())
while k > 0:
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	k = k - 1
print(n)


(j, k) = list(map(int, input().split()))
n = j
for i in range(k):
	lastdigit = int(repr(n)[-1])
	if lastdigit != 0:
		n = n - 1
	elif lastdigit == 0:
		n = n // 10
print(n)


(k, l) = list(map(int, input().split()))
for i in range(0, l):
	if k % 10 == 0:
		k = k / 10
	else:
		k = k - 1
print(int(k))


def solve():
	(n, k) = map(int, input().split())
	for i in range(k):
		if int(str(n)[-1]) > 0:
			n = n - 1
		elif int(str(n)[-1]) == 0:
			n = n // 10
	print(n)
t = 1
for __ in range(t):
	solve()


try:
	(m, n) = map(int, input().split())
	while n != 0:
		if m % 10 == 0:
			m = m // 10
		else:
			m -= 1
		n -= 1
	print(m)
except EOFError:
	pass


arr = list(map(int, input().split()))
n = arr[0]
k = arr[1]
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


(a, b) = [int(a) for a in input().split()]
for i in range(1, b + 1):
	if a % 10 != 0:
		a = a - 1
	else:
		a = a // 10
print(a)


try:
	(n, k) = map(int, input().split())
	m = n
	c = 0
	while m != 0:
		m = m // 10
		c += 1
	for _ in range(k):
		if c == 1:
			n = n - 1
			if n == 0:
				break
		elif n % 10 != 0:
			n = n - 1
		elif n % 10 == 0:
			n = n // 10
		elif n == 0:
			break
	print(n)
except:
	pass


ls = list(map(int, input().split()))
for j in range(ls[1]):
	if ls[0] % 10 > 0:
		ls[0] = ls[0] - 1
	else:
		ls[0] = ls[0] // 10
print(ls[0])


try:
	[a, b] = list(map(int, input().split(' ')))
	for i in range(b):
		if a % 10 == 0:
			a = int(a / 10)
		else:
			a -= 1
	print(a)
except:
	pass


(n, k) = list(map(int, input().split()))
nn = str(n)
while k:
	if nn[-1] != '0':
		n -= 1
		nn = str(n)
	else:
		n = n // 10
		nn = str(n)
	k -= 1
print(n)


(A, B) = list(map(int, input().split(' ')))
for i in range(B):
	if str(A)[-1] != '0':
		A -= 1
	else:
		A //= 10
print(A)


(n, k) = input().split()
n = list(n)[::-1]
k = int(k)
for (idx, i) in enumerate(n):
	if k > 0:
		i = int(i)
		if i > 0 and i >= k:
			n[idx] = str(int(n[idx]) - k)
			k = 0
			i = int(n[idx])
			break
		elif k >= i + 1:
			n[idx] = str(0)
			k -= i + 1
			if k == 0:
				idx += 1
				break
	if k == 0:
		break
print(int(''.join(n[idx:][::-1])))


l = list(map(int, input().strip().split()))
n = l[0]
k = l[1]
i = 0
while i < k:
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
	i += 1
print(n)


(n, k) = [int(x) for x in input().split()]
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)