Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:  if the last digit of the number is non-zero, she decreases the number by one;  if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit). 

You are given an integer number $n$. Tanya 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 positive integer number.


-----Input-----

The first line of the input contains two integer numbers $n$ and $k$ ($2 \le n \le 10^9$, $1 \le k \le 50$) — the number from which Tanya will subtract and the number of subtractions correspondingly.


-----Output-----

Print one integer number — the result of the decreasing $n$ by one $k$ times.

It is guaranteed that the result will be positive integer number. 


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

Output
50

Input
1000000000 9

Output
1



-----Note-----

The first example corresponds to the following sequence: $512 \rightarrow 511 \rightarrow 510 \rightarrow 51 \rightarrow 50$.

Source: codeforces | Difficulty: EASY
Tags: Implementation


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


(n, k) = map(int, input().split())
for i in range(k):
	string = str(n)
	if string[len(string) - 1] == '0':
		n //= 10
	else:
		n -= 1
print(n)


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


import sys
nk = sys.stdin.readline()
while nk:
	(n, k) = [int(val) for val in nk.split()]
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n = n // 10
	print(n)
	nk = sys.stdin.readline()


(n, k) = map(int, input().split())
for _ in range(k):
	n = n - 1 if n % 10 else n // 10
print(n)


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


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


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


(n, k) = map(int, input().split())
a = n
b = 1
for i in range(k):
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n = n // 10
print(n)


(a, b) = map(int, input().split(' '))
for i in range(b):
	if a % 10 > 0:
		a = a - 1
	else:
		a = a // 10
print(a)


arr = [int(i) for i in input().split()]
(n, t) = (arr[0], arr[1])
while t > 0:
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
	t -= 1
print(n)


def f(n, k):
	np = n % 10
	return n - k if k <= np else f(n // 10, k - np - 1)
[n, k] = [int(x) for x in input().split()]
print(f(n, k))


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


(n, a) = map(int, input().split())
for x in range(a):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


def tanya(num):
	if num % 10 > 0:
		num -= 1
	else:
		num = num / 10
	return num
(n, k) = [int(x) for x in input().split()]
subs = n
for x in range(k):
	subs = tanya(subs)
print(int(subs))


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


s = input()
l = s.split()
n = int(l[0])
k = int(l[1])
while k >= 1:
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	k = k - 1
print(n)


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


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


def substract(val):
	if val % 10 == 0:
		return val // 10
	else:
		return val - 1
(n, k) = map(int, input().split())
for i in range(k):
	n = substract(n)
print(n)


(m, n) = map(int, input().split())
for _ in range(n):
	if m % 10 == 0:
		m = m // 10
	else:
		m = m - 1
print(m)


def subtract(n, k):
	i = 0
	while i != k:
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
		i += 1
	return n
(n, k) = map(int, input().split())
res = subtract(n, k)
print(res)


tanya = input().split()
number = int(tanya[0])
n = int(tanya[1])
while n > 0:
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
	n -= 1
print(int(number))


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


def listToString(s):
	str1 = ''
	for ele in s:
		str1 = str(str1) + str(ele)
	return str1

def subtract(_number):
	_numberList = list(str(_number))
	if _numberList[len(_numberList) - 1] != '0':
		_numberList[len(_numberList) - 1] = int(_numberList[len(_numberList) - 1]) - 1
		_numberListRefined = listToString(_numberList)
		return _numberListRefined
	else:
		_numberList.pop()
		_numberListRefined = listToString(_numberList)
		return _numberListRefined
(number, subtractions) = input('').split(' ')
currentValue = number
for i in range(int(subtractions)):
	currentValue = subtract(currentValue)
print(currentValue)


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


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


(n, k) = map(int, input().split())
for i in range(k):
	lst = int(n % 10)
	if lst != 0:
		n = int(n - 1)
	elif lst == 0:
		n = int(n / 10)
print(n)


def Subtraction(m, n):
	for i in range(n):
		if m % 10 != 0:
			m = m - 1
		else:
			m = m // 10
	return m
(a, b) = input().split()
print(Subtraction(int(a), int(b)))


(n, m) = map(int, input().split())
ans = n
for i in range(m):
	if ans % 10 == 0:
		ans = ans // 10
	else:
		ans = ans - 1
print(ans)


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


(a, b) = list(map(str, input().split()))
for i in range(int(b)):
	if len(a) >= 2:
		if a[-1] == '0':
			a = a[:-1]
		else:
			a = str(int(a) - 1)
	else:
		a = str(int(a) - 1)
print(a)


(n, a) = map(int, input().split())
for i in range(a):
	if n % 10:
		n -= 1
	else:
		n /= 10
print(int(n))


(StrNumber, StrK) = input().split(' ', 2)
number = int(StrNumber)
k = int(StrK)
for i in range(k):
	if number % 10 == 0:
		number = number / 10
	else:
		number -= 1
print(int(number))


(*a,) = map(int, input().split(' '))
x = a[0]
y = a[1]
while y != 0:
	if x % 10 == 0:
		x //= 10
	else:
		x -= 1
	y -= 1
print(x)


(n, k) = [int(x) for x in input().split()]
while k > 0:
	if n % 10 == 0:
		n = int(n / 10)
	else:
		rem = n % 10
		n = int(n / 10)
		n = n * 10 + rem - 1
	k -= 1
print(int(n))


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


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


import math
from collections import defaultdict
from collections import Counter
import itertools

def solve(n, k):
	while k:
		cand = int(str(n)[-1])
		if cand == 0:
			n = n // 10
		else:
			n = n - 1
		k -= 1
	return n
(n, k) = map(int, input().split(' '))
print(solve(n, k))


string = str(input())
arr = string.split()
num = int(arr[0])
for i in range(int(arr[1])):
	if str(num)[len(str(num)) - 1] == '0':
		num = int(str(num)[0:len(str(num)) - 1])
	else:
		num = num - 1
print(num)


def change(n):
	if str(n)[-1] == '0':
		return n // 10
	return n - 1
(n, k) = map(int, input().split())
for i in range(k):
	n = change(n)
print(n)


ip = [int(i) for i in input().split(' ')]
nu = ip[0]
times = ip[1]
for i in range(times):
	if nu % 10 != 0:
		nu -= 1
	else:
		nu = nu / 10
print(int(nu))


def subtract_one(n):
	if str(n)[-1] == '0':
		return n // 10
	else:
		return n - 1

def subtract_k(n, k):
	for ii in range(k):
		n = subtract_one(n)
	return n
(n, k) = [int(item) for item in input().split(' ')]
print(subtract_k(n, k))


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


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


a = list(map(int, input().split()))
number = a[0]
iterations = a[1]
iterator = 0
while iterator < iterations:
	if number % 10 == 0:
		number = number / 10
	else:
		number = number - 1
	iterator = iterator + 1
print(int(number))


(ns, ks) = input().split()
n = int(ns)
k = int(ks)
for i in range(0, k):
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n /= 10
print(int(n))


from sys import stdin

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


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


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


(x, y) = input().split()
i = int(y)
j = int(x)
while i > 0:
	i = i - 1
	if j % 10 == 0:
		j = j // 10
	else:
		j = j - 1
print(j)


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


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


while True:
	try:
		(n, k) = [int(number) for number in input().split()]
		for i in range(k):
			n = n - 1 if n % 10 != 0 else n // 10
		print(n)
	except EOFError:
		break


(x, k) = list(map(int, input().split()))
while k > 0:
	if x % 10 == 0:
		x = int(str(x)[:-1])
	else:
		x -= 1
	k -= 1
print(x)


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


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


a = input()
li = a.split()
i = 0
while i < len(li):
	li[i] = int(li[i])
	i += 1
i = li[1]
while i > 0:
	if li[0] % 10 == 0:
		li[0] = li[0] // 10
	else:
		li[0] = li[0] - 1
	i -= 1
print(li[0])


(n, k) = map(int, input().strip().split())
for i in range(k):
	if n % 5 == 0 and n % 2 == 0:
		n //= 10
	else:
		n -= 1
print(n)


strin = str(input())
vals = strin.split(' ')
n = int(vals[0])
k = int(vals[1])
for m in range(k):
	z = str(n)
	if z[len(z) - 1] == '0':
		n = int(n / 10)
	else:
		n = int(n - 1)
print(n)


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


def sub(n):
	if n % 10 != 0:
		n = n - 1
	else:
		n = n / 10
	return n

def cal_sub(n, k):
	for i in range(k):
		n = sub(n)
	return int(n)
str = input()
n = int(str.split(' ')[0])
k = int(str.split(' ')[1])
print(cal_sub(n, k))


l = [int(i) for i in input().split()]
m = l[0]
n = l[1]
while n > 0:
	n = n - 1
	if m % 10 == 0:
		m = m / 10
	else:
		m = m - 1
print(int(m))


inp = input()
(a, b) = inp.split(' ')
n = int(a)
k = int(b)
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n /= 10
print(int(n))


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


def solution(num, count):
	for i in range(count):
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
	return int(num)
inp = list(map(int, input().split()))
num = inp[0]
count = inp[1]
print(solution(num, count))


x = input()
x = x.split()
n = int(x[0])
k = int(x[1])
while k > 0:
	p = n % 10
	if k <= p:
		n = n - k
		k = 0
		break
	elif p == 0:
		k = k - 1
		n = round(n / 10)
	else:
		n = n - p
		k = k - p
print(n)


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


(number, times) = map(int, input().split())
while times:
	if number % 10:
		number -= 1
	else:
		number //= 10
	times -= 1
print(number)


import sys
(n, k) = sys.stdin.readline().split()
(n, k) = (int(n), int(k))
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
sys.stdout.write(str(n) + '\n')


(n, k) = input().split()
n = list(n)
k = int(k)
while k > 0:
	l = int(n[len(n) - 1])
	if l != 0:
		if l >= k:
			l -= k
			n[len(n) - 1] = str(l)
			k = 0
		else:
			k -= l
			n[len(n) - 1] = '0'
	else:
		n.pop(len(n) - 1)
		k -= 1
buf = n[0]
for i in range(1, len(n)):
	buf += n[i]
print(int(buf))


def subtraction(number, num_of_sub):
	while number % 10 == 0:
		number = number / 10
	if number % 10 >= num_of_sub:
		return number - num_of_sub
	else:
		if number > num_of_sub:
			for _ in range(0, num_of_sub):
				if number % 10 != 0:
					number -= 1
				else:
					number /= 10
			return number
		return 1
input_list = list(map(int, input().rsplit()))
print(int(subtraction(input_list[0], input_list[1])))


a = input()
(number, times) = a.split(' ')
for i in range(int(times)):
	if int(number) % 10 == 0:
		number = int(number) // 10
	else:
		number = int(number) - 1
print(number)


(m, n) = map(int, input().split())
for i in range(n):
	if m % 10 != 0:
		m = m - 1
	elif m % 10 == 0:
		m = int(str(m)[0:len(str(m)) - 1])
print(int(m))


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


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


import math
import os
import random
import re
import sys
inp = input()
arr = inp.split(' ')
res = int(arr[0])
num1 = int(arr[1])
i = 0
while i < num1:
	i = i + 1
	if res % 10 == 0:
		res = res / 10
	else:
		res = res - 1
print(int(res))


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, k) = zz()
for _ in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print(n)


def solution():
	(n, k) = map(int, input().split())
	for _ in range(k):
		if str(n)[-1] != '0':
			n -= 1
		else:
			n //= 10
	print(n)
solution()


def f(x):
	if x % 10 == 0:
		return x // 10
	return x - 1
(l, k) = input().split()
(l, k) = (int(l), int(k))
for i in range(k):
	l = f(l)
print(l)


def wrong_sub(n, k):
	for i in range(k):
		digit = n % 10
		if digit == 0:
			n /= 10
		else:
			n -= 1
	return int(n)
(n, k) = map(int, input().split())
print(wrong_sub(n, k))


(n, k) = map(str, input().split())
n = list(map(int, n))
k = int(k)
for i in range(k):
	if n[len(n) - 1] != 0:
		n[len(n) - 1] -= 1
	else:
		del n[len(n) - 1]
print(''.join((str(e) for e in n)))


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


(n, k) = map(int, input().split())
digits = [int(x) for x in str(n)]
for i in range(k):
	if digits[-1] == 0:
		digits.pop()
	else:
		digits[-1] -= 1
print(''.join(map(str, digits)))


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


import sys
line = sys.stdin.readline().strip()
(n, k) = list(map(int, line.split()))
for i in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(number, times) = map(int, input().split())
counter = 0
while times > counter:
	if number % 10 == 0:
		number = int(number / 10)
		counter += 1
	else:
		ld = int(number % 10)
		t = ld if ld + counter < times else times - counter
		counter += t
		number = int(number - t)
print(number)


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


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def sub(n, k):
	for i in range(k):
		n = n - 1 if n % 10 else n // 10
	return n
(n, k) = invr()
n = sub(n, k)
print(n)


x = input().split()
a = x[0]
a = int(a)
b = x[1]
b = int(b)
i = 0
while b > i:
	if a % 10 == 0:
		a = a / 10
	else:
		a = a - 1
	i += 1
a = int(a)
print(a)


from sys import stdin
_input = stdin.readline
_int = int

def solution():
	(arr, n) = [_int(i) for i in _input().split()]
	while n > 0:
		if n < arr % 10:
			arr -= n
			n = 0
		else:
			n -= arr % 10
			if n > 0:
				arr //= 10
				n -= 1
			else:
				arr -= arr % 10
	print(arr)
solution()


nums = input().split()
n = list(nums[0])
k = int(nums[1])
while k > 0:
	ones = len(n) - 1
	if n[ones] == '0':
		n = n[:ones]
		k -= 1
	else:
		diff = int(n[ones]) - k
		if diff < 0:
			n[ones] = '0'
			k = abs(diff)
		else:
			n[ones] = str(diff)
			k = 0
print(*n, sep='')


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


str = input()
space = str.index(' ')
n = int(str[:space])
k = int(str[space + 1:])
for i in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n /= 10
print(int(n))


inp = input().strip().split()
N = int(inp[0])
K = int(inp[1])
for i in range(K):
	if N % 10 == 0:
		N = N // 10
	else:
		N = N - 1
print(N)


(n, k) = input().split(' ')
k = int(k)
l = len(n)
for i in range(l - 1, -1, -1):
	if int(n[i]) < k:
		k = k - int(n[i]) - 1
		n = n[0:i]
	elif int(n[i]) == k:
		n = n[0:i] + '0'
		break
	else:
		n = int(n)
		n = n - k
		break
print(n)


inp = input().split(' ')
n = list(inp[0])
k = int(inp[1])
index = len(n) - 1
for i in range(k):
	if n[index] == '0':
		n.pop()
		index -= 1
	else:
		n[index] = int(n[index]) - 1
		n[index] = str(n[index])
print(''.join(n))


(a, b) = input().split()
result = int(a)
for x in range(int(b)):
	result = result / 10 if result % 10 == 0 else result - 1
print(int(result))


(number, k) = input().split()
number = int(number)
k = int(k)
i = 1
while i <= k:
	if number % 10 != 0:
		number = number - 1
	else:
		number = number // 10
	i = i + 1
print(number)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
while k > 0:
	n = n // 10 if n % 10 == 0 else n - 1
	k -= 1
stdout.write(str(n) + '\n')


import sys
(n, k) = map(int, sys.stdin.readline().strip().split(' '))
for _ in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


def WrongSubstraction(n, k):
	if k == 0:
		return int(n)
	if n > 9:
		if n % 10 == 0:
			return WrongSubstraction(n / 10, k - 1)
		else:
			return WrongSubstraction(n - 1, k - 1)
	else:
		return WrongSubstraction(n - 1, k - 1)
(n, k) = [int(x) for x in input().split()]
print(WrongSubstraction(n, k))


(n, k) = input().strip().split(' ')
k = int(k)
n = list(n)
while k:
	if int(n[-1]) > 0:
		n[-1] = str(int(n[-1]) - 1)
	else:
		n = n[:-1]
	k -= 1
print(''.join(n))


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


(val, key) = map(int, input().split())
while key != 0:
	if val % 10 == 0:
		val = int(val / 10)
		key -= 1
	else:
		val -= 1
		key -= 1
print(val)


(n, k) = input().split()
n = int(n)
k = int(k)

def last_digit(num):
	return num - 10 * (num // 10)
for i in range(k):
	if last_digit(n) == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


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


(a, b) = input().split()
for i in range(int(b)):
	if a[-1] == '0':
		a = a[:-1]
	else:
		a = str(int(a) - 1)
print(a)


(a, k) = map(int, input().strip().split())
for i in range(k):
	if a % 10 != 0:
		a -= 1
	elif a % 10 == 0:
		a = a // 10
print(a)


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def solve():
	(n, k) = sep()
	for i in range(0, k):
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
	print(n)
testcase(1)


x = list(map(int, input().strip().split()))
(a, b) = (x[0], x[1])
a = str(a)
for i in range(b):
	if a[-1] != '0':
		a = int(a)
		a = a - 1
	elif a[-1] == '0':
		a = int(a)
		a = a // 10
	a = str(a)
print(a)


(number, iterations) = [int(x) for x in input().split()]
while iterations > 0:
	if number % 10 != 0:
		number -= 1
	else:
		number /= int(10)
	iterations -= 1
print(int(number))


(n, k) = map(int, input().split())
sub = list(str(n))
sub = list(map(int, sub))
sub.reverse()
for i in range(k):
	if sub[0] != 0:
		sub[0] = sub[0] - 1
	else:
		sub.pop(0)
sub.reverse()
sub = list(map(str, sub))
ans = ''.join(sub)
print(ans)


nums = input().split()
num = int(nums[0])
times = int(nums[1])
for i in range(times):
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
print(round(num))


user_input = input('')

def Convert(string):
	global lista
	lista = list(string.split(' '))
	return lista
Convert(user_input)
x = int(lista[0])
y = int(lista[1])
while y != 0:
	if x % 10 == 0:
		x = x / 10
		y = y - 1
	else:
		x = x - 1
		y = y - 1
print(int(x))


import sys
(n, k) = map(int, sys.stdin.readline().split())

def wrong_sub(n, k):
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n = n // 10
	print(n)
wrong_sub(n, k)


(n, k) = [int(x) for x in input().split()]
for i in range(k):
	s = list(str(n))
	if s[-1] == '0':
		s.pop()
		n = int(''.join(s))
	else:
		n -= 1
print(n)


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


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


def wrong_subtraction(n, k):
	i = 0
	while i < k:
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
		i += 1
	print(int(n))
n = tuple(map(int, input().split(' ')))
wrong_subtraction(n[0], n[1])


(n, k) = map(int, input().split())
while k > 0:
	c = str(n)
	lastdi = int(c[len(c) - 1])
	if lastdi >= k:
		n -= k
		k = 0
	else:
		k -= lastdi + 1
		n //= 10
print(n)


def wrongSubstraction(n, k):
	i = 1
	while i <= k:
		r = n % 10
		if r > 0:
			n -= 1
		else:
			n /= 10
		i += 1
	return int(n)
(n, k) = map(int, input().split())
print(wrongSubstraction(n, k))


(value, times) = map(int, input().split())
intv = int(value)
last = str(value)[-1]
last = int(last)
u = last
for i in range(times):
	if u == 0:
		intv = intv // 10
	elif u != 0:
		intv = intv - 1
	u = str(intv)
	u = u[-1]
	u = int(u)
print(intv)


a = [int(i) for i in input().split(' ')]
m = a[0]
d = a[1]
c = 0
for i in range(d):
	if m % 10 > 0:
		m += -1
	else:
		m = m / 10
print(int(m))


inp = input().split(' ')
number = int(inp[0])
k = int(inp[1])
for i in range(0, k):
	if str(number)[-1] != '0':
		number -= 1
	else:
		number = int(number / 10)
print(number)


def main():
	info = input().split()
	num1 = int(info[0])
	num2 = int(info[1])
	for i in range(num2):
		if num1 % 10 == 0:
			num1 = int(num1 / 10)
		else:
			num1 = num1 - 1
	print(num1)
main()


inp = str(input())
a = inp.split()
k = a[0]
n = a[1]
n = int(n)
k = int(k)
i = 0
while i < n:
	if k % 10 != 0:
		k = k - 1
	elif k % 10 == 0:
		k = k / 10
	i = i + 1
k = int(k)
print(k)


from sys import stdin, exit
(n, k) = map(int, stdin.readline().rstrip().split(' '))
for _ in range(k):
	if n % 10 > 0:
		n -= 1
	else:
		n //= 10
print(n)


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


entry = input().split(' ')
res = int(entry[0])
for i in range(int(entry[1])):
	if str(int(res))[-1] == '0':
		res = int(res) / 10
	else:
		res = int(res) - 1
print(int(res))


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


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


(q, w) = map(int, input().split())
for i in range(w):
	q = str(q)
	if q[-1] != '0':
		q = int(q) - 1
	else:
		q = int(str(q[:-1]))
print(q)


def solve(size: int, n: int):
	while size > 0:
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
		size -= 1
	return n
val = input().split()
ans = solve(int(val[1]), int(val[0]))
print(ans)


def wsub(a):
	if a % 10 == 0:
		a = int(a / 10)
	else:
		a = a - 1
	return a
(n, k) = map(int, input().split())
for i in range(k):
	n = wsub(n)
print(n)


(number, k) = map(int, input().split())
for i in range(k):
	if number % 10 != 0:
		number = number - 1
	elif number % 10 == 0:
		number = number / 10
print(int(number))


def op(num):
	if num % 10 != 0:
		return num - 1
	else:
		return num // 10
(n, k) = map(int, input().split())
for _ in range(k):
	n = op(n)
print(n)


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


input1 = list(input().split(' '))
int1 = input1[0]
int2 = int(input1[1])
if int(int1) >= 2 and int(int1) <= pow(10, 9) and (int2 <= 50):
	while int2 > 0:
		if str(int1)[-1] == '0':
			int1 = int(int(int1) / 10)
		else:
			int1 = int(int1)
			int1 = int1 - 1
		int2 = int2 - 1
print(int1)


def get_ans_rec(number, times):
	if times == 0:
		return number
	if number % 10 == 0:
		number = number // 10
	else:
		number = number - 1
	return get_ans_rec(number, times - 1)
user_input = input()
(number, times) = (int(x) for x in user_input.split(' '))
print(get_ans_rec(number, times))


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


(a, b) = map(int, input().split())
tot = 0
t = a
for i in range(1, b + 1):
	rem = t % 10
	if rem == 0:
		t = t // 10
	elif rem != 0:
		t = t - 1
print(t)


(a, b) = map(int, input().split())
while b:
	if int(a) % 10 > 0:
		a = str(int(a) - 1)
	elif int(a) % 10 == 0:
		a = str(int(a) // 10)
	b -= 1
print(a)


import math
(m, n) = map(int, input().split())
for i in range(0, n):
	if m % 10 == 0:
		m = m / 10
	else:
		m = m - 1
print(math.trunc(m))


(s, k) = map(str, input().split())
for i in range(int(k)):
	if s[len(s) - 1] == '0':
		s = s[0:len(s) - 1]
	else:
		s = str(int(s) - 1)
print(s)


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


import sys

def subtract(n, k):
	while k >= 1:
		if n % 10 != 0:
			n = n - 1
		else:
			n = n / 10
		k = k - 1
	return int(n)
numberInput = input().split()
print(subtract(int(numberInput[0]), int(numberInput[1])))


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


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


def digitsct(n):
	ct = 0
	while n != 0:
		n //= 10
		ct += 1
	return ct
(n, k) = map(int, input().split())
while digitsct(n) >= 2 and k > 0:
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
	k -= 1
while k > 0:
	n -= 1
	k -= 1
print(int(n))


(a, b) = map(int, input().split())
p = 1
a = list(str(a))
while p <= b:
	a[-1] = int(a[-1])
	if a[-1] != 0:
		a[-1] -= 1
		p += 1
		continue
	if a[-1] == 0:
		del a[-1]
		p += 1
n = len(a)
for i in range(n):
	a[i] = str(a[i])
a = ''.join(a)
print(a)


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


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


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


before = input()
split_before = before.split()
first_number = int(split_before[0])
second_number = int(split_before[1])
for num in range(second_number):
	if first_number % 10 == 0:
		first_number = first_number // 10
	else:
		first_number = first_number - 1
print(first_number)


def main():
	while 1:
		try:
			(n, k) = input().split(' ')
			n = int(n)
			k = int(k)
			while k > 0:
				if n % 10 == 0:
					n /= 10
					k -= 1
				else:
					rem = n % 10
					if rem > k:
						n -= k
						k = 0
					else:
						n -= rem
						k -= rem
			print(int(n))
		except:
			break
main()


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


fr = list(map(int, input().split()))
(n, k) = (fr[0], fr[1])
for _1 in range(k):
	if str(n)[-1] == '0':
		n //= 10
	else:
		n -= 1
print(n)


(digit, count_subtractions) = map(int, input().split())
for i in range(count_subtractions):
	if digit % 10 == 0:
		digit //= 10
		count_subtractions -= 1
	if digit % 10 != 0 and count_subtractions != 0:
		digit -= 1
		count_subtractions -= 1
	if count_subtractions == 0:
		print(digit)
		break


import sys

def solution(n, k):
	result = n
	for i in range(k):
		if str(result).endswith('0'):
			result = result // 10
		else:
			result -= 1
	return result
line = sys.stdin.readline()
while line:
	(n, k) = line.split()
	print(solution(int(n), int(k)))
	line = sys.stdin.readline()


def get_result(first_num, second_num):
	if first_num > 10 ** 9 or first_num < 2:
		return False
	elif second_num < 1 or second_num > 50:
		return False
	if int(str(first_num)[len(str(first_num)) - 1]) == 0:
		if second_num - 1 == 0:
			return int(first_num / 10)
		return get_result(int(first_num / 10), second_num - 1)
	if second_num - 1 == 0:
		return first_num - 1
	return get_result(first_num - 1, second_num - 1)
nums = input()
print(get_result(int(nums.split()[0]), int(nums.split()[1])))


(a, b) = map(int, input().split())
for i in range(b):
	c = a % 10
	if c > 0:
		a = a - 1
	elif c == 0:
		a = a // 10
print(a)


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


input_list = []
num = 0
while True:
	if num == 1:
		break
	line = input()
	line = line.split()
	line = list(map(int, line))
	num += 1
number = line[0]
for i in range(line[1]):
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
print(int(number))


(number, substractions) = input().split()
number = int(number)
substractions = int(substractions)
for i in range(0, substractions):
	if number % 10 != 0:
		number -= 1
	else:
		number = number / 10
print(int(number))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
(n, k) = mi()
for i in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n //= 10
print(n)


nums = list(map(int, input().split()))
n = nums[1]
number = nums[0]
for x in range(n):
	if number % 10 != 0:
		number -= 1
	else:
		number = number / 10
print(int(number))


string_input = input()
string_list = string_input.split(' ')
first_num = int(string_list[0])
second_num = int(string_list[1])

def divide(first_num):
	return int(first_num / 10)

def minus(first_num):
	return first_num - 1
for i in range(second_num):
	if str(first_num)[-1] == '0':
		first_num = divide(first_num)
	else:
		first_num = minus(first_num)
print(first_num)


(no, n) = map(int, input().split())
for i in range(n):
	if str(no)[-1] != '0':
		no -= 1
	else:
		no = int(str(no)[:-1])
print(no)


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


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


n = list(map(int, input().split()))
a = n[0]
b = n[1]
for x in range(b):
	if a % 10 != 0:
		a = a - 1
	elif a % 10 == 0:
		a = a // 10
print(a)


info = input().split(' ')
num = int(info[0])
for _ in range(int(info[1])):
	if str(num)[-1] == '0':
		num = num // 10
	else:
		num -= 1
print(num)


(n, k) = [int(d) for d in input().split()]
while k > 0:
	r = n % 10
	if r > 0:
		n -= 1
	else:
		n /= 10
	k -= 1
print(int(n))


(a, b) = input().split()
a = list(map(int, a))
b = int(b)
for i in range(b):
	if a[-1] == 0:
		a.pop()
	else:
		a[-1] = a[-1] - 1
for i in range(len(a)):
	print(a[i], end='')


(n, k) = map(int, input().split())
if 2 <= n <= 10 ** 9 and 1 <= k <= 50:
	while k != 0:
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
		k -= 1
print(int(n))


(digit, n) = input().split()
for i in range(int(n)):
	if digit[-1] == '0':
		digit = digit[:-1]
	else:
		digit = str(int(digit) - 1)
print(int(digit))


def solve_wrong_subtraction(answers):
	for i in range(0, answers[1]):
		if answers[0] % 10 != 0:
			answers[0] -= 1
		else:
			answers[0] = answers[0] / 10
	print(int(answers[0]))
integer_given = [int(x) for x in input().split(' ')]
solve_wrong_subtraction(integer_given)


def help_tanya(n, k):
	while True:
		last_digit = n % 10
		while last_digit == 0:
			k = k - 1
			n /= 10
			if k == 0:
				return n
			last_digit = n % 10
		if k <= last_digit:
			return n - k
		k -= last_digit
		n -= last_digit
	return n
nums = input('').split(' ')
(n, k) = [int(num) for num in nums]
print(int(help_tanya(n, k)))


(n, k) = map(int, input().split())

def wrongSubtraction(n, k):
	if k == 0:
		return n
	if n % 10 == 0:
		return wrongSubtraction(n // 10, k - 1)
	else:
		return wrongSubtraction(n - 1, k - 1)
print(wrongSubtraction(n, k))


inputLine = input()
inputLine = inputLine.split(' ')
Num = int(inputLine[0])
Reps = int(inputLine[1])
while Reps > 0:
	if Num % 10 == 0:
		Num = Num / 10
	else:
		Num = Num - 1
	Reps = Reps - 1
print(int(Num))


temp = input()
temp = temp.split(' ')
n = temp[0]
k = int(temp[1])
final = int(n)
for i in range(k):
	if len(n) > 1 and n[len(n) - 1] == '0':
		final = final / 10
	else:
		final = final - 1
	n = str(int(final))
print(int(final))


no = input()
no = no.split(' ')
nos1 = int(no[0])
nos2 = int(no[1])
for i in range(0, nos2):
	if nos1 % 10 == 0:
		nos1 /= 10
	else:
		nos1 -= 1
print(int(nos1))


data = input()
data = data.split(' ')
num_1 = int(data[0])
num_2 = int(data[1])
while 0 < num_2:
	if num_1 % 10 == 0:
		num_1 = num_1 // 10
		num_2 -= 1
	elif num_1 % 10 != 0 and num_1 > 0:
		num_1 -= 1
		num_2 -= 1
	elif num_1 == 0:
		num_2 = 1
		continue
print(num_1)


s = input().split()
l = int(s[0])
m = int(s[1])
while m != 0:
	if l % 10 != 0:
		l = l - 1
	else:
		l = l // 10
	m = m - 1
print(l)


def foolish(a):
	if a % 10 == 0:
		return a // 10
	else:
		return a - 1
n_k = input().split()
n = int(n_k[0])
k = int(n_k[1])
for i in range(k):
	n = foolish(n)
print(n)


def function(x, y):
	for i in range(y):
		if x % 10 == 0:
			x = x / 10
		else:
			x = x - 1
	return int(x)
(x, y) = input().split()
x = int(x)
y = int(y)
print(function(x, y))


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

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

def I():
	return int(input())

def LS():
	return input().split()

def S():
	return input()

def main():
	(n, k) = LI()
	c = 0
	while True:
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
		c += 1
		if c == k:
			return n
print(main())


import sys
import math
import os
l = []
(n, k) = sys.stdin.readline().split()
n = int(n)
k = int(k)
num = n
for i in range(k):
	if str(num)[-1] == '0':
		num = int(str(num)[:-1])
	else:
		num = num - 1
print(num)


z = list(map(int, input().split()))
x = z[0]
y = z[1]
i = 0
while y > 0:
	if x % 10 == 0:
		x = x / 10
	else:
		x = x - 1
	y -= 1
print(int(x))


(x, y) = [int(x) for x in input().split()]
while x > -1:
	for z in range(y):
		if x % 10 == 0:
			x //= 10
		else:
			x -= 1
	break
print(x)


entry = input().split()
number = int(entry[0])
subtractions = int(entry[1])
for i in range(subtractions):
	if number % 10 == 0:
		number //= 10
	else:
		number -= 1
print(number)


def wrong_subs(num, sub):
	for i in range(sub):
		if num % 10 == 0:
			num = num / 10
		else:
			num = num - 1
	print(int(num))
n = input()
(num, sub) = map(int, n.split())
wrong_subs(num, sub)


def decrease(n: int):
	if n % 10 == 0:
		return int(n / 10)
	return n - 1
nk = input()
nk = nk.split(' ')
n = int(nk[0])
k = int(nk[1])
for i in range(k):
	n = decrease(n)
print(n)


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


s = input()
v = int(s.split()[0])
n = int(s.split()[1])
for i in range(n):
	if str(v)[-1] == '0':
		v /= 10
	else:
		v -= 1
	v = int(v)
print(v)


(n, k) = map(int, input().split())
count = 0
for item in range(k):
	if str(n)[-1] != '0':
		n -= 1
	else:
		n //= 10
	count += 1
	if count == k:
		print(n)


inputs = input().split(' ')
for i in range(len(inputs)):
	inputs[i] = int(inputs[i])
for i in range(inputs[1]):
	if inputs[0] % 10 == 0:
		inputs[0] /= 10
	else:
		inputs[0] -= 1
print(int(inputs[0]))


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

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


(a, b) = map(int, input().split(' '))
while b > 0:
	remain = a % 10
	if remain == 0:
		b -= 1
		a /= 10
	elif b >= remain:
		b >= remain
		a -= remain
		b -= remain
	else:
		a -= b
		break
print(int(a))


d = input()
d = d.split(' ')
r = int(d[1])
f = int(d[0])
for i in range(r):
	f = int(f)
	if str(f)[-1] != '0':
		f -= 1
	else:
		f = str(f)[:-1]
print(f)


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


string = input()
l = string.split()
(n1, n2) = (int(l[0]), int(l[1]))
res = n1
for i in range(n2):
	s = str(res)
	if s[-1] == '0':
		res //= 10
	else:
		res = res - 1
print(res)


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


import sys

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


def prob(n, m):
	for i in range(m):
		if str(n)[-1] == '0':
			n = int(n / 10)
		else:
			n = n - 1
	return n
(n, m) = map(int, input().split())
print(prob(n, m))


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


(n, k) = (int(i) for i in input().split())
while k:
	if n % 10:
		n -= 1
	else:
		n //= 10
	k -= 1
print(n)


from sys import stdin, stdout
line = stdin.readline().split()
n = [int(i) for i in line[0]]
k = int(line[1])
while k > 0:
	k -= 1
	if n[len(n) - 1] == 0:
		n.pop()
	else:
		n[len(n) - 1] -= 1
for i in n:
	stdout.write(str(i))


s = input()
num = int(s[0:s.find(' ')])
n = int(s[s.find(' ') + 1:])
for i in range(n):
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
print(int(num))


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


data = input().split(' ')
n = [int(i) for i in data[0]]
k = int(data[1])
for i in range(k):
	if n[len(n) - 1] == 0:
		del n[len(n) - 1]
	else:
		n[len(n) - 1] -= 1
res = ''
for i in n:
	res += str(i)
res = int(res)
print(res)


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


inp = list(map(int, input().split()))
a = inp[0]
b = inp[1]
for _ in range(b):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


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


(h, v) = [x for x in input().split()]
z = '-1'
y = '//10'
c = 1
v = int(v)
while c <= v:
	if h[len(h) - 1] != '0':
		h = eval(h + z)
		h = str(h)
		c = c + 1
	else:
		h = eval(h + y)
		h = str(h)
		c = c + 1
print(h)


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


chaine = input()
L = chaine.split(' ')
a = int(L[1])
m = int(L[0])
for i in range(0, a):
	if L[0][-1] == '0':
		m = m // 10
		L[0] = str(m)
	else:
		m = m - 1
		L[0] = str(m)
print(m)


def update_number(n, k):
	while k:
		last_digit = n % 10
		if not last_digit:
			k -= 1
			n //= 10
			continue
		if last_digit >= k:
			n -= k
			break
		n -= last_digit
		k -= last_digit
	return n

def main():
	(n, k) = tuple(map(int, input().strip().split()))
	print(update_number(n, k))
main()


input = input().split()
value = int(input[0])
size = int(input[1])
for i in range(size):
	if value % 10 == 0:
		value /= 10
	else:
		value -= 1
print(int(value))


from sys import stdout
(n, k) = input().split(' ')
k = int(k)
for i in range(k):
	if n[-1] != '0':
		n = str(int(n) - 1)
	else:
		n = str(int(int(n) / 10))
stdout.write('{}\n'.format(n))


def minus_one(n, k):
	while k > 0:
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
		k -= 1
	return n

def main():
	(num, k) = [int(x) for x in input().split()]
	print(minus_one(num, k))
main()


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


(div, loop) = map(int, input().split())
for _ in range(loop):
	if div % 10:
		div -= 1
	else:
		div //= 10
print(div)


(q1, q2) = map(int, input().split())
for i in range(q2):
	e = q1 % 10
	if e == 0:
		q1 = q1 // 10
	else:
		q1 -= 1
print(q1)


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


from sys import stdin, stdout
(n, b) = map(int, stdin.readline().split())
for _ in range(b):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
stdout.write(str(n))


(m, n) = [i for i in input().split()]
for case in range(int(n)):
	m = str(int(m) // 10 if m[-1] == '0' else int(m) - 1)
print(m)


(a, b) = map(int, input().split())
if 2 <= a and 1 <= b <= 50:
	for i in range(b):
		if a % 10 == 0:
			a = a / 10
		else:
			a = a - 1
	print(int(a))


(initial, steps) = map(int, input().split())
for _ in range(steps):
	if initial % 10 != 0:
		initial -= 1
	else:
		initial = initial // 10
print(initial)


a = input() + ' '
b = ''
A = []
for j in range(len(a)):
	if a[j] == ' ':
		A.append(int(b))
		b = ''
	else:
		b += a[j]
for i in range(A[1]):
	if A[0] % 10 == 0:
		A[0] = A[0] // 10
	else:
		A[0] = A[0] - 1
print(A[0])


x = input()
(n, k) = map(int, x.split())

def SubS(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = n // 10
		elif n % 10 != 0:
			n = n - 1
	print(n)
SubS(n, k)


(a, b) = map(int, input().split())
for _ in range(b):
	if not a % 10:
		a /= 10
	else:
		a -= 1
print(int(a))


(n, k) = input().split(' ')
n = int(n)
k = int(k)
if n in range(2, 10 ** 9 + 1) and k in range(1, 51):
	for i in range(0, k):
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
	print(n)


string = input()
s = string.split(' ')
n = int(s[0])
k = int(s[1])

def func(nmb, tm):
	if tm == k:
		return nmb
	elif nmb % 10 == 0:
		return func(nmb // 10, tm + 1)
	else:
		return func(nmb - 1, tm + 1)
ans = func(n, 0)
print(ans)


(num, times) = map(int, input().split())
for i in range(times):
	ld = num % 10
	if ld > 0:
		num -= 1
	else:
		num = num / 10
print(int(num))


(nn, k) = input().split()
k = int(k)
n = list(nn)
for i in range(k):
	if n[-1] == '9':
		n[-1] = '8'
	elif n[-1] == '8':
		n[-1] = '7'
	elif n[-1] == '7':
		n[-1] = '6'
	elif n[-1] == '6':
		n[-1] = '5'
	elif n[-1] == '5':
		n[-1] = '4'
	elif n[-1] == '4':
		n[-1] = '3'
	elif n[-1] == '3':
		n[-1] = '2'
	elif n[-1] == '2':
		n[-1] = '1'
	elif n[-1] == '1':
		n[-1] = '0'
	elif n[-1] == '0':
		n.remove(n[-1])
po = ''.join((i for i in n))
print(po)


(num, times) = list(map(int, input().split()))
while times != 0:
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
	times -= 1
print(num)


def main():
	n = input().split()
	result = 0
	for x in range(int(n[1])):
		if n[0][-1] == '0':
			n[0] = str(int(n[0]) // 10)
		else:
			n[0] = str(int(n[0]) - 1)
	print(n[0])
main()


(x, y) = [int(x) for x in input().strip().split()]
while y > 0:
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
	y -= 1
print(int(x))


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


from sys import stdin
inp = stdin.readline
(n, k) = [int(k) for k in inp().split()]
while k > 0:
	k -= 1
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print(n)


console = list(map(int, input().split()))
num = console[0]
k = console[1]
while k > 0:
	last = num % 10
	if last != 0:
		if last <= k:
			k = k - last
			num = num - last
		else:
			num = num - k
			k = 0
	else:
		k -= 1
		num = num // 10
print(num)


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


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


(n, m) = map(int, input().split())
i = 0
while i != m:
	if n % 10 == 0:
		n = n // 10
	elif n % 10 != 0:
		n = n - 1
	i = i + 1
print(n)


def subtr(input):
	n = int(input.split(' ')[0])
	k = int(input.split(' ')[1])
	if n >= 2 and n <= 10 ** 9 and (k >= 1) and (k <= 50):
		while k > 0:
			if n % 10 == 0:
				n = int(n / 10)
			else:
				n = n - 1
			k = k - 1
		print(n)
	else:
		return
subtr(input())


user_input = input().split(' ')
number = int(user_input[0])
steps = int(user_input[1])
while steps != 0:
	if number % 10 == 0:
		number = number // 10
	else:
		number = number - 1
	steps -= 1
print(number)


lst = [int(i) for i in input().split()]

def sub_algo(n, k):
	steps = 0
	while steps < k:
		if n % 10 != 0:
			n = n - 1
			steps += 1
		else:
			n = int(n / 10)
			steps += 1
	return n
print(sub_algo(lst[0], lst[1]))


def main():
	(number, times) = input().split(' ')
	times = int(times)
	number = int(number)
	for i in range(times):
		if number % 10 != 0:
			number -= 1
		else:
			number = number / 10
	print(int(number))
main()


ip = input()
ip_array = ip.split(' ')
n = int(ip_array[0])
k = int(ip_array[1])

def f(n, k):
	for i in range(k):
		if n % 10 != 0:
			n = n - 1
		else:
			n = n // 10
	return n
print(f(n, k))


(n1, n2) = map(int, input().split())
result = n1
n = 0
while n < n2:
	if result % 10 == 0:
		result = result / 10
	else:
		result = result - 1
	n = n + 1
print(int(result))


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


(a, b) = map(int, input().strip().split())
for _ in range(b):
	if a % 10 != 0:
		a -= 1
	else:
		a //= 10
print(a)


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


def lastnonzero(number):
	number = int(number) - 1
	return int(number)

def lastzero(number):
	number = int(number) / 10
	return int(number)
(num, numtimes) = map(str, input().split())
for i in range(int(numtimes)):
	if int(num[-1]) == 0:
		num = str(lastzero(num))
	else:
		num = str(lastnonzero(num))
print(int(num))


a = input()
a = a.split(' ')
lol = int(a[0])
thing = int(a[1])
for _ in range(thing):
	fjbbb = list(str(lol))
	if fjbbb[-1] != '0':
		lol -= 1
	elif fjbbb[-1] == '0':
		lol //= 10
print(lol)


import math
(n, k) = input().split()
n = int(n)
k = int(k)
i = 0
while i < k:
	if n % 10 == 0:
		n = n / 10
	else:
		n -= 1
	i += 1
print(round(n))


(number, count) = input().split(' ')
count = int(count)
for _ in range(count):
	figure = int(number[-1])
	if figure == 0:
		number = number[:len(number) - 1]
	else:
		number = number[:len(number) - 1] + str(figure - 1)
print(number)


NO = input()
List = NO.split()
n = int(List[0])
k = int(List[1])
RR = n
for i in range(k):
	if int(List[0][-1]) == 0:
		RR = int(RR / 10)
	else:
		RR -= 1
	List[0] = str(RR)
print(RR)


import math
(m, k) = input().split()
m = int(m)
k = int(k)
while k != 0:
	if m % 10 == 0:
		m = m / 10
	else:
		m = m - 1
	k = k - 1
print(int(m))


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


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


s = input()
for i in range(len(s)):
	if s[i] == ' ':
		n = int(s[:i])
		break
k = int(s[i + 1:])
for i in range(k):
	if n % 10 == 0:
		n = n / 10
		continue
	n = n - 1
print(int(n))


(n, k) = list(map(int, input().split(' ')))
for j in range(0, k):
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n = n / 10
print(int(n))


def wrong_sub(n, k):
	if k == 0:
		return n
	if n % 10 == 0:
		return wrong_sub(n // 10, k - 1)
	return wrong_sub(n - 1, k - 1)
(n, k) = map(int, input().split())
print(wrong_sub(n, k))


def sub(x):
	if x % 10 == 0:
		return x // 10
	return x - 1
(n, k) = map(int, input().split())
for _ in range(k):
	n = sub(n)
print(n)


def main():
	(s, k) = input().split()
	s = [int(i) for i in s]
	for i in range(int(k)):
		if s[-1] == 0:
			s = s[:-1]
		else:
			s[-1] = s[-1] - 1
	print(*s, sep='')
main()


(n, d) = map(int, input().split())
aux = 0
while aux < int(d):
	if str(n)[-1] != '0':
		n -= 1
	else:
		n = n // 10
	aux += 1
print(n)


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


args = input().split(' ')
n = int(args[0])
k = int(args[1])
i = 0
while i < k:
	if n % 10 != 0:
		n -= 1
	else:
		n = n / 10
	i += 1
print(int(n))


(x, y) = [int(x) for x in input().split()]
for a in range(0, y):
	if x % 10 != 0:
		x -= 1
	elif x % 10 == 0:
		x = x / 10
print(int(x))


(a, b) = input().split(' ')
a = int(a)
b = int(b)
k = 1

def hesap():
	if a % 10 == 0:
		a = a / 10
	else:
		a = a - 1
while k <= b:
	k += 1
	if a % 10 == 0:
		a = a / 10
	else:
		a = a - 1
a = int(a)
print(a)


(num, times) = input().split()
num = int(num)
times = int(times)
for i in range(0, times):
	if num % 10 != 0:
		num = num - 1
	elif num % 10 == 0:
		num = num // 10
print(num)


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


(num, div) = map(int, input().split())
num = str(num)
for i in range(div):
	if int(num[len(num) - 1]) == 0:
		num = num[:len(num) - 1]
	else:
		num = str(int(num) - 1)
print(num)


import copy
import sys
try:
	(n, k) = map(int, input().split())
	s = str(n)
	i = len(s) - 1
	c = 0
	while i >= 0 and c <= k:
		c = c + int(s[i]) + 1
		i -= 1
	if c - k - 1 >= 0:
		print(s[:i + 1] + str(c - k - 1))
	else:
		print(s[:i + 1])
except EOFError as e:
	pass


entry = input()
n = len(entry)
number = 0
k_times = 0
for (i, j) in enumerate(entry):
	if j == ' ':
		number = int(entry[0:i])
		k_times = int(entry[i + 1:])
		break
result = 0
for i in range(k_times):
	if number % 10 == 0:
		number = number // 10
	else:
		number = number - 1
print(number)


(num, k) = input().split(' ')
(num, k) = (int(num), int(k))
for i in range(k):
	if num % 10:
		num -= 1
	else:
		num /= 10
print(int(num))


def func(n, k):
	if k == 0:
		return n
	else:
		if n % 10 == 0:
			return func(n // 10, k - 1)
		return func(n - 1, k - 1)
(n, k) = list(map(int, input().split()))
result = func(n, k)
print(result)


def readline():
	return tuple(map(int, input().split()))

def main():
	(n, k) = readline()
	while k:
		(q, r) = divmod(n, 10)
		if k >= r + 1:
			n = q
			k -= r + 1
		else:
			n -= k
			k = 0
	print(n)
main()


def main():
	(x, y) = input().split()
	(num, cnt) = (int(x), int(y))
	for i in range(cnt):
		if num % 10 == 0:
			num = num // 10
		else:
			num -= 1
	print(num)
main()


numList = input().split(' ')
num = int(numList[0])
times = int(numList[1])
while times > 0:
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
	times -= 1
print(num)


def loop(ar):
	n = ar[0]
	k = ar[1]
	for i in range(0, k):
		if str(n)[-1] == '0':
			n = int(n / 10)
		else:
			n -= 1
	print(n)
ar = list(map(int, input().rstrip().split()))
loop(ar)


(a, b) = [str(x) for x in input().split()]
for i in range(int(b)):
	if a[-1] != '0':
		a = f'{int(a) - 1}'
	elif a[-1] == '0':
		a = f'{int(a) // 10}'
print(a)


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


(s, n) = input().split(' ')
n = int(n)
for i in range(n):
	a = len(s) - 1
	if int(s[a]) == 0:
		s = str(int(int(s) / 10))
	else:
		s = str(int(s) - 1)
print(s)


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


def wrongSubtract(x):
	if x % 10 == 0:
		return x // 10
	else:
		return x - 1
(n, x) = map(int, input().split())
for i in range(x):
	n = wrongSubtract(n)
print(n)


nk = input().split()
num = int(nk[0])
k = int(nk[1])
for _ in range(k):
	lastDigit = num % 10
	if lastDigit == 0:
		num = num // 10
	else:
		num -= 1
print(num)


(num1, cases) = input().split()
(num1, cases) = (int(num1), int(cases))
temp = num1
cont = 0
for i in range(cases):
	if temp % 10 == 0:
		temp /= 10
	else:
		temp -= 1
print(int(temp))


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


def test_0():
	import math
	from collections import Counter
	(n, k) = list(map(int, input().split(' ')))
	a = n
	for i in range(k):
		if a % 10 != 0:
			a = a - 1
		else:
			a = int(a / 10)
	print(a)
test_0()


(n, k) = [int(item) for item in input().split(' ')]
while k > 0:
	last_digit = n % 10
	if last_digit == 0:
		n = n / 10
	else:
		n -= 1
	k -= 1
n = int(n)
print(n)


def algo(n, k):
	while k != 0:
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
		k -= 1
	return n
inputs = input().split()
(n, k) = (int(inputs[0]), int(inputs[1]))
print(algo(n, k))


(n, k) = input().split()
k = int(k)
for i in range(k):
	if n[-1] == '0':
		n = n[:-1]
	else:
		q = int(n[-1])
		n = n[:-1] + str(q - 1)
print(n)


a = input()
lst = a.split(' ')
n = int(lst[0])
k = int(lst[1])
if 2 <= n <= 1000000000 and 1 <= k <= 50:
	while k > 0:
		k = k - 1
		if n % 10 != 0:
			n = n - 1
		else:
			n = n / 10
print(int(n))


(num, k) = map(int, input().split())
for i in range(k):
	if str(num)[-1] != '0':
		num -= 1
	elif str(num)[-1] == '0':
		num = num // 10
print(int(num))


input_l = input()
input_var = input_l.split()
input_ = int(input_var[0])
iter = int(input_var[1])
while iter > 0:
	last = input_ % 10
	if last == 0:
		input_ = input_ // 10
	else:
		input_ = input_ - 1
	iter -= 1
print(input_)


myinput = input().split(' ')
number = int(myinput[0])
time = int(myinput[1])
for i in range(0, time):
	if number % 10 == 0:
		number = number // 10
	else:
		number = number - 1
print(number)


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


(a, b) = input().split(' ')
for i in range(int(b)):
	if str(a).endswith('0') == True:
		a = int(a) // 10
	else:
		a = int(a) - 1
	b = int(b) - 1
	if int(b) == 0:
		break
print(a)


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


from sys import stdin, stdout
write = stdout.write
(n, k) = map(int, stdin.readline().split())
for i in range(k):
	if str(n)[len(str(n)) - 1] == '0':
		n = n // 10
	else:
		n -= 1
print(n)


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


(a, b) = map(int, input().split(' '))
while b > 0:
	if str(a)[-1] != '0':
		a -= 1
	else:
		lt = list(str(a))
		del lt[-1]
		a = int(''.join(lt))
	b = b - 1
print(a)


def wrong_substraction(number, n):
	for i in range(0, n):
		if number % 10 == 0:
			number = number // 10
		else:
			number = number - 1
	return number
(number, n) = map(int, input().split())
print(wrong_substraction(number, n))


def wrongsubtraction(n, k):
	firstdigits = str(n)[:len(str(n)) - 1]
	lastdigit = int(str(n)[len(str(n)) - 1])
	if lastdigit != 0:
		lastdigit = lastdigit - 1
		temp = int(str(firstdigits) + str(lastdigit))
		if k != 1:
			wrongsubtraction(temp, k - 1)
		else:
			print(str(temp))
	else:
		temp = int(str(firstdigits))
		if k != 1:
			wrongsubtraction(temp, k - 1)
		else:
			print(str(temp))
(a, b) = input().split(' ')
wrongsubtraction(int(a), int(b))


(n, k) = input().split()
for _ in range(int(k)):
	if int(n[-1]) > 0:
		t = int(n) - 1
	else:
		t = int(n) // 10
	n = str(t)
print(n)


(a, k) = map(int, input().split())
while k > 0:
	b = a % 10
	if b == 0:
		a //= 10
		k -= 1
	else:
		if b > k and k < 10:
			a -= k
			k = 0
			break
		k -= b
		a -= b
print(a)


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


while True:
	(n, k) = map(int, input().split(' '))
	if n >= 2 and n <= 10 ** 9 and (k >= 1) and (k <= 50):
		break
for i in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n = n - 1
print(n)


(x, t) = [int(x) for x in input().split()]
while t > 0:
	if x % 10 != 0:
		x -= 1
	else:
		x = x / 10
	t -= 1
print(int(x))


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


import sys, math
(n, m) = map(int, sys.stdin.readline().split())
for loop in range(m):
	if str(n)[len(str(n)) - 1] == '0':
		n = n // 10
	else:
		n = n - 1
print(n)


def main():
	(n, k) = [int(t) for t in input().split(' ')]
	while k != 0:
		k -= 1
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
	print(int(n))
main()


def subtraction(n):
	for x in range(int(n[1])):
		if n[0] % 10 > 0:
			n[0] = n[0] - 1
		else:
			n[0] = n[0] / 10
	return int(n[0])
print(subtraction(list(map(int, input().split()))))


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


(x, y) = [int(a) for a in input().split()]

def ers(x):
	if x % 10 == 0:
		return x // 10
	else:
		return x - 1
for _ in range(y):
	x = ers(x)
print(x)


import sys
array = input().split(' ')
for (i, val) in enumerate(array):
	array[i] = int(val)
number = array[0]
diff = array[1]
count = diff
while diff > 0:
	diff -= 1
	if number % 10 == 0:
		number = number / 10
	else:
		number -= 1
print(round(number))


x = input()
(number, steps) = x.split(' ')
number = int(number)
steps = int(steps)
while steps:
	if number % 10:
		number -= 1
	else:
		number /= 10
	steps -= 1
print(int(number))


(n, h) = map(int, input().split())
for i in range(h):
	ld = n % 10
	if ld > 0:
		n = n - 1
	else:
		n = n / 10
print(int(n))


def wrong_sub(num, times):
	while times > 0:
		if num % 10 == 0:
			num = int(num / 10)
		else:
			num = num - 1
		times -= 1
	print(num)
(input_num, input_times) = input().split(' ')
wrong_sub(int(input_num), int(input_times))


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


(n, k) = input().split()
for _ in range(0, int(k)):
	if n[len(n) - 1] == '0':
		n = n[:len(n) - 1]
	else:
		n = str(int(n) - 1)
print(n)


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


def call_me(n, k):
	m = n
	while k:
		if m % 10:
			m = m - 1
		else:
			m = m // 10
		k -= 1
	return m
(n, k) = [int(i) for i in input().split()]
ans = call_me(n, k)
print(ans)


s = input().split(' ')
n = int(s[0])
for _ in range(int(s[1])):
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


str1 = input()
t = str1.split(' ')
a = int(t[0])
b = int(t[1])
for i in range(b):
	a = a - 1 if str(a)[-1] != '0' else int(a / 10)
print(a)


def subtract(x, k):
	for _ in range(k):
		if x % 10 == 0:
			x //= 10
		else:
			x -= 1
	return x
print(subtract(*map(int, input().split())))


emon = input().split()
x = emon[0]
y = int(emon[1])
m = list(x)
for i in range(y):
	a = m[-1]
	if m[-1] != '0':
		m.pop()
		c = int(a) - 1
		m.append(str(c))
	else:
		m.remove('0')
g = ''.join(m)
print(g)


(num, no_of_times) = map(int, input().split())
for i in range(no_of_times):
	if num % 10 != 0:
		num = num - 1
	else:
		num = num / 10
print(int(num))


def wrong_decrease(n, k):
	while k > 0:
		a = n % 10
		if a == 0:
			k = k - 1
			n = n / 10
		else:
			n = n - min([k, a])
			k = k - a
	print(int(n))
(n, k) = map(int, input().split())
wrong_decrease(n, k)


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


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


ele = list(map(int, input().split()))
for i in range(0, ele[1]):
	t = ele[0] % 10
	if t == 0:
		ele[0] = int(ele[0] / 10)
	if t != 0:
		ele[0] = int(ele[0] - 1)
print(ele[0])


(a, n) = map(int, input().split())
arr = [a] * (n + 1)
for j in range(n):
	if arr[j] % 10 == 0:
		arr[j + 1] = arr[j] // 10
	else:
		arr[j + 1] = arr[j] - 1
print(arr[-1])


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


from time import sleep
sleep(1)
(n, k) = input().split()
n = list(n)
k = int(k)
while k != 0:
	if n[-1] == '0':
		k -= 1
		n = n[:-1]
	else:
		ld = int(n[-1])
		if ld > k:
			ld -= k
			k = 0
			n[-1] = str(ld)
		else:
			k -= ld
			n[-1] = '0'
print(''.join(map(str, n)))


import math
import os
import random
import re
import sys

def get_ints():
	return map(int, input().split())
(n, k) = get_ints()
while k and n:
	if n % 10:
		n -= 1
	else:
		n //= 10
	k -= 1
print(n)


(no, c) = input().split(' ')
no = int(no)
c = int(c)
for i in range(0, c):
	if no % 10 == 0:
		no /= 10
	else:
		no -= 1
print(int(no))


(n, k) = map(int, input().split())
done = 0
while done < k:
	if str(n)[-1] == '0':
		n //= 10
		done += 1
	if done == k:
		break
	if str(n)[-1] != '0':
		done += 1
		n -= 1
print(n)


(p, n) = map(int, input().split())
for b in range(n):
	p = p - 1 if p % 10 else p // 10
print(p)


(n, k) = map(lambda x: int(x), input().split())
while n % 10 < k:
	k -= n % 10 + 1
	n //= 10
print(n - k)


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


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


(n1, n2) = input().split()
for i in range(int(n2)):
	if str(n1)[-1] == '0':
		n1 = int(n1) // 10
	else:
		n1 = int(n1) - 1
print(n1)


a = list(map(int, input().split()))
b = a[0]
for r in range(0, a[1]):
	if str(b)[len(str(b)) - 1] == '0':
		b = int(b / 10)
	else:
		b = b - 1
print(b)


(n, k) = map(int, input().split())
ans = n
if (n >= 2 or n <= 10 ^ 9) and (k >= 1 or k <= 50):
	for i in range(k):
		if ans % 10 == 0:
			ans = ans // 10
		else:
			ans = ans - 1
print(ans)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split(' '))
while k != 0:
	m = n
	last = int(m % 10)
	if last != 0:
		n = n - 1
	else:
		n = n // 10
	k = k - 1
print(n)


entry = input()
entry = [int(i) for i in entry.split()]
for e in range(entry[1]):
	if entry[0] % 10 == 0:
		entry[0] = entry[0] / 10
	else:
		entry[0] -= 1
print(int(entry[0]))


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


(y, z) = input().split()
k = 0
y = int(y)
z = int(z)
a = 0
while z != k:
	if y % 10 == 0:
		y = y // 10
	else:
		y = y - 1
	k = k + 1
print(y)


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


(a, b) = map(int, input().split())
c = 0
m = True
while m:
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
	c = c + 1
	if c == b:
		m = False
print(a)


(a, b) = map(int, input().split())
res = 0
step = 0
while b > step:
	if str(a)[-1] == '0':
		a = a // 10
		step += 1
	else:
		a = a - 1
		step += 1
print(a)


from math import *
R = lambda : map(int, input().split())
(n, k) = R()
for _ in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


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


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


(n, k) = input().split()
n = int(n)
k = int(k)
if n >= 2 and n <= 1000000000 and (k >= 1) and (k <= 50):
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
print(int(n))


from sys import stdin, stdout
import math
(N, K) = [int(x) for x in stdin.readline().split()]
for i in range(K):
	if N % 10 != 0:
		N -= 1
	else:
		N = N // 10
print(N)


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


a = [int(i) for i in input().split()]
n = a[0]
k = a[1]
last = n % 10
while k != 0:
	if k > last and last != 0:
		k = k - last
		n = n - last
		if k == 0:
			break
	elif k <= last and last != 0:
		n = n - k
		k = 0
		if k == 0:
			break
	elif last == 0:
		k = k - 1
		n = n // 10
		if k == 0:
			break
	last = n % 10
print(n)


import sys
(n, k) = map(int, sys.stdin.readline().split(' '))
b = list(map(int, str(n)))
while k > 0:
	if b[len(b) - 1] == 0:
		n /= 10
		b = list(map(int, str(int(n))))
	else:
		n -= 1
		b = list(map(int, str(int(n))))
	k -= 1
sys.stdout.write(str(int(n)))
sys.stdout.flush()


numandtimes = input().split()
num = int(numandtimes[0])
times = int(numandtimes[1])
for i in range(times):
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
print(num)


vstup = input()
vstup = vstup.split()
n = int(vstup[0])
k = int(vstup[1])

def tanya(n, k):
	for iteration in range(k):
		if n % 10 == 0:
			n /= 10
			n = int(n)
		else:
			n -= 1
	return n
print(tanya(n, k))


import sys
input = sys.stdin.readline
(n, k) = str(input()).split(' ')
n = int(n)
k = int(k)
for i in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n = n - 1
print(n)


def getResult(num, k):
	tail = num % 10
	if k <= tail:
		print(num - k)
	else:
		getResult(num // 10, k - tail - 1)
raw = input().split(' ')
(num, k) = [int(x) for x in raw]
getResult(num, k)


l = list(map(int, input().strip().split()))
n = l[0]
k = l[1]
for i in range(k):
	s = str(n)
	if s[-1] == '0':
		n = n // 10
	else:
		n = n - 1
print(n)


import sys
user_input = input()
user_input_arr = user_input.split(' ')
if len(user_input_arr) > 1:
	n = int(user_input_arr[0])
	k = int(user_input_arr[1])
	for i in range(0, k):
		n_to_string = str(n)
		last_char = n_to_string[len(n_to_string) - 1]
		if int(last_char) == 0:
			n = int(n / 10)
		else:
			n = n - 1
	print(n)


(n, k) = input().split()
n = int(n)
k = int(k)
while k > 0:
	if n in range(2, 1000000001) and k in range(1, 51):
		if n % 10 == 0:
			n = n // 10
			k = k - 1
		else:
			n = n - 1
			k = k - 1
	else:
		break
print(n)


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


nums = str(input())
sepNums = nums.split(' ')
num1 = int(sepNums[0])
num2 = int(sepNums[1])
while num2 > 0:
	if num1 % 10 == 0:
		num1 = num1 / 10
		num2 = num2 - 1
	else:
		num1 = num1 - 1
		num2 = num2 - 1
print(int(num1))


(n, w) = map(int, input().split())
num = 0
for i in range(w):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


lst = list(input().split())
y = [int(elem) for elem in lst]
x = list(lst[0])
count = 0
while count < y[1]:
	if x[-1] != '0':
		y[0] -= 1
		count += 1
		lst[0] = str(y[0])
		x = list(lst[0])
	else:
		x.pop()
		count += 1
		lst[0] = ''.join(x)
		y[0] = int(lst[0])
print(y[0])


(n, k) = input().split()
k = int(k)
n = list(map(int, n))
i = len(n) - 1
while k:
	if n[i] < k:
		k -= n[i] + 1
		i -= 1
	else:
		n[i] -= k
		k = 0
print(*n[:i + 1], sep='')


(number, count) = list(map(int, input().split()))
for i in range(count):
	strNum = str(number)
	if strNum[len(strNum) - 1] == '0':
		number //= 10
	else:
		number -= 1
print(number)


import sys
a = sys.stdin.readline().split()
n = int(a[0])
k = int(a[1])
i = 0
while i in range(k):
	if n % 10 == 0:
		n /= 10
		i += 1
	else:
		n -= 1
		i += 1
print(int(n))


n = input()
l = []
l = n.split(' ')
a = int(l[0])
b = int(l[1])
for i in range(b):
	if a % 10 == 0:
		a = a / 10
	else:
		a -= 1
print(str(int(a)))


def subtract(num):
	if str(num)[-1] != '0':
		num -= 1
	else:
		num = num // 10
	return num
(the_number, num_subtractions) = [int(a) for a in input().strip().split()]
for _ in range(num_subtractions):
	the_number = subtract(the_number)
print(the_number)


(n, k) = map(int, input().split())
while k > 0:
	ldn = int(str(n)[-1])
	if ldn == 0:
		n //= 10
		k -= 1
	elif ldn <= k:
		n -= ldn
		k -= ldn
	else:
		n -= k
		k = 0
print(n)


(a, b) = map(int, input().split())

def minus(a):
	if a % 10 == 0:
		return a // 10
	return a - 1
for i in range(b):
	a = minus(a)
print(a)


import sys
import os
t = sys.stdin.readline()
vals = t.split()
init_number = vals[0]
q_subs = int(vals[1])
for i in range(q_subs):
	last_digit = init_number[-1]
	if int(last_digit) != 0:
		init_number = str(int(init_number) - 1)
	else:
		init_number = init_number[:-1]
print(init_number)


import math
import sys
input = sys.stdin.readline

def invr():
	return list(map(int, input().split()))
(n, k) = invr()
d = n % 10
while k > 0:
	if d == 0:
		n = int(n / 10)
		k -= 1
		d = n % 10
	elif d > k:
		n -= k
		k = 0
	else:
		k -= d
		n -= d
		d = 0
print(n)


def string_to_list(string):
	list1 = list()
	for i in string:
		list1.extend(i)
	return list1

def init():
	a = input()
	list2 = list(a.split(' '))
	return list2

def divid_string(list):
	a = str(list[0])
	return a

def main_args():
	list1 = init()
	num = int(divid_string(list1))
	k = int(list1[1])
	i = 0
	while i < k:
		list3 = string_to_list(str(int(num)))
		if int(list3[-1]) != 0:
			num -= 1
		else:
			num /= 10
		i += 1
	else:
		return int(num)
print(main_args())


(n, k) = list(map(int, input().strip().split()))
for i in range(k):
	last_digit = n % 10
	if last_digit != 0:
		n -= 1
	elif last_digit == 0:
		n = n // 10
print(n)


x = list(input().split())
num = x[0]
n = int(x[1])
for i in range(n):
	if num[len(num) - 1] != '0':
		num = str(int(num) - 1)
	else:
		num = str(int(int(num) / 10))
print(num)


import sys
local_launch = False
try:
	open('LOCAL').read()
	local_launch = True
except:
	pass
input_data = open('INPUT.txt').read() if local_launch else sys.stdin.read()
done = {'i': 0}
tokens = input_data.split()

def next_token():
	result = tokens[done['i']]
	done['i'] += 1
	return result

def next_int():
	return int(next_token())

def next_str():
	return next_token()
n = next_int()
k = next_int()
count = 0
while count != k:
	if n % 10 != 0:
		n = n - 1
	else:
		n = n // 10
	count += 1
print(n)


a = input().split()
pl = int(a[0])
lo = int(a[1])
for i in range(lo):
	if pl % 10 == 0:
		pl = int(str(pl)[:-1])
	else:
		pl -= 1
print(pl)


inp = input().split()
N = inp[0]
k = int(inp[1])
for i in range(k):
	if N[-1] != '0':
		N = N[:len(N) - 1] + str(int(N[-1]) - 1)
	else:
		N = N[:len(N) - 1]
print(N)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	(n, k) = map(int, input().split())
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n //= 10
	print(n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


info = [int(x) for x in input().split()]
for i in range(info[1]):
	if str(info[0])[-1] == '0':
		info[0] = int(info[0] / 10)
	else:
		info[0] -= 1
print(info[0])


i = input().split(' ')
listi = list(i)
for m in range(int(listi[1])):
	if int(listi[0][-1]) == 0:
		listi[0] = listi[0][0:-1]
	else:
		p = int(listi[0][-1])
		q = p - 1
		q = str(q)
		listi[0] = listi[0][0:-1] + q
print(listi[0])


t = list(map(int, input().split()))
y = int(t[0])
z = int(t[1])
c = 1
k = 1
i = 0
while z > 0:
	if y % 10 != 0:
		y = y - 1
		z = z - 1
	elif y % 10 == 0:
		y = y // 10
		z = z - 1
print(y)


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


from collections import defaultdict

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


data = input().split(sep=' ')
(num1, num2) = (int(data[0]), int(data[1]))
for _ in range(num2):
	if num1 % 10 == 0:
		num1 = num1 / 10
	else:
		num1 = num1 - 1
print(int(num1))


def solve(a, b):
	for i in range(b):
		if str(a)[-1] != '0':
			a -= 1
		else:
			a //= 10
	return a
ab = input().split()
a = int(ab[0])
b = int(ab[-1])
print(solve(a, b))


import math as m
(k, t) = map(int, input().split())
for i in range(t):
	if k % 10 == 0:
		k = k / 10
	elif k % 10 != 10:
		k -= 1
print(m.ceil(k))


ints = []
ints = input().split(' ')
subNum = int(ints[0])
subTim = int(ints[1])
for i in range(0, subTim):
	if subNum % 10 == 0:
		subNum /= 10
	else:
		subNum -= 1
print(int(subNum))


def ans():
	a = input().split()
	tar = int(a[0])
	tim = int(a[1])
	while tim != 0:
		if tar % 10 != 0:
			tar = tar - 1
			tim = tim - 1
		else:
			tar = tar // 10
			tim = tim - 1
	print(tar)
ans()


numbers = [int(i) for i in input().split()]
n = numbers[0]
k = numbers[1]
while k > 0:
	if str(n)[-1] == '0':
		n = int(n / 10)
		k = k - 1
	else:
		n = n - 1
		k = k - 1
print(n)


console_input = input().split()
n = console_input[0]
k = int(console_input[1])
N = int(n)
for i in range(0, k):
	if n[-1] != '0':
		N -= 1
	else:
		N = int(N / 10)
	n = str(N)
print(n)


def main():
	(nb, k) = map(int, input().split())
	for _ in range(k):
		if not nb % 10:
			nb /= 10
		else:
			nb -= 1
	print(int(nb))
main()


inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
while k != 0:
	mod = n % 10
	if mod == 0:
		k -= 1
		n //= 10
	elif mod + 1 <= k:
		n //= 10
		k -= mod + 1
	else:
		n -= k
		k = 0
print(n)


def rec(number, sub_left):
	if sub_left == 0:
		return number
	str_num = str(number)
	if str_num[len(str_num) - 1] == '0':
		n = rec(number // 10, sub_left - 1)
	else:
		n = rec(number - 1, sub_left - 1)
	return n
arr = input().split()
num = int(arr[0])
sub = int(arr[1])
val = rec(num, sub)
print(val)


s = str(input(''))
l = s.split(' ')
n = int(l[0])
k = int(l[1])
a = 1
while a <= k:
	b = n % 10
	if b == 0:
		n = int(n / 10)
	else:
		n = n - 1
	a = a + 1
print(n, end='')


numbers = input('')
aList = numbers.split(' ')
for twice in range(2):
	aList[twice] = int(aList[twice])
for x in range(int(aList[1])):
	if aList[0] % 10 != 0:
		aList[0] -= 1
	else:
		aList[0] = int(aList[0] / 10)
print(aList[0])


import sys
input = sys.stdin.read()
tokens = input.split()
a = int(tokens[0])
b = int(tokens[1])

def subs(x, y):
	while y > 0:
		if x % 10 == 0:
			x = x / 10
		else:
			x = x - 1
		y = y - 1
	return x
print(int(subs(a, b)))


x = [int(x) for x in input().split(' ')]
num_sub = x[0]
tim = x[1]
for time in range(int(tim)):
	if num_sub % 10 != 0:
		num_sub -= 1
	else:
		num_sub = num_sub / 10
print(int(num_sub))


(number, times) = map(int, input().split())
for _ in range(times):
	last_digit = int(str(number)[-1])
	if last_digit != 0:
		number -= 1
	else:
		number = int(str(number)[:-1])
print(number)


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


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


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


def subtract(n, k):
	i = 0
	while i < k:
		if n % 10 != 0:
			n -= 1
		else:
			n = n // 10
		i += 1
	print(n)
(n, k) = list(map(int, input().split()))
subtract(n, k)


(n, k) = map(int, input().split())
a = list(str(n))
res = 0
i = len(a) - 1
while res <= k and i >= 0:
	res += int(a[i]) + 1
	i -= 1
if res > k:
	res -= int(a[i + 1]) + 1
	a[i + 1] = str(int(a[i + 1]) - (k - res))
	print(''.join(a[:i + 2]))
else:
	print(''.join(a[:i + 1]))


from sys import stdin
rdl = stdin.readline
(N, k) = rdl().strip().split()
N = int(N)
k = int(k)
for _ in range(k):
	if N % 10 == 0:
		N = N // 10
	else:
		N -= 1
print(N)


def wrongSub(n, k):
	for i in range(0, k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	return n
(n, k) = map(int, input().strip().split(' '))
print(wrongSub(n, k))


(w, s) = input().split()
for i in range(int(s)):
	if w[-1] == '0':
		w = w[:-1]
	else:
		w = int(w) - 1
		w = str(w)
print(w)


import sys
l = sys.stdin.readline()
while l:
	(n, k) = l.split()
	for i in range(int(k)):
		if n[-1] == '0':
			n = n[:-1]
		else:
			n = str(int(n) - 1)
	print(n)
	l = sys.stdin.readline()


li = list(map(int, input().split(' ')))
i = 0
while i < li[1]:
	if str(li[0])[-1:] == '0':
		li[0] = li[0] // 10
	else:
		li[0] = li[0] - 1
	i = i + 1
print(li[0])


import math
import sys, collections
MAXN = 10000001

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def get_array():
	l = list(map(int, input().split()))
	return l

def get_2_ints():
	(a, b) = map(int, input().split())
	return (a, b)

def get_3_ints():
	(a, b, c) = map(int, input().split())
	return (a, b, c)

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	(ind, floor) = (-1, -1)
	while left <= right:
		mid = (left + right) // 2
		if x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			ind = mid
			left = mid + 1
	return ind
mod = 10 ** 9 + 7

def main():
	(n, k) = get_2_ints()
	while k:
		k = k - 1
		if str(n)[-1] == '0':
			n = n // 10
		else:
			n -= 1
	print(n)
main()


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
(n, k) = mInt()
for _ in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print(n)


def main():
	(n, k) = input().split(' ')
	k = int(k)
	numDigits = len(n)
	for i in range(numDigits):
		index = numDigits - 1 - i
		lastDigit = int(n[index])
		if lastDigit >= k:
			return n[:index] + str(lastDigit - k)
		else:
			k -= lastDigit + 1
output = main()
print(output)


import sys
l = sys.stdin.readline().split()
n = int(l[0])
k = int(l[1])
for iteration in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


prompt = [int(i) for i in input().split(' ')]
for i in range(prompt[1]):
	if str(prompt[0])[len(str(prompt[0])) - 1] != '0':
		prompt[0] -= 1
	else:
		prompt[0] = int(str(prompt[0])[:len(str(prompt[0])) - 1])
print(prompt[0])


(d, m) = map(int, input().strip().split())
for i in range(m):
	if d % 10 == 0:
		d = d / 10
	else:
		d = d - 1
print(int(d))


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


(n, k) = map(int, input().split())
while k > 0:
	ldig = n % 10
	if ldig == 0:
		n = n // 10
		k -= 1
		continue
	if k <= ldig:
		n -= k
		break
	k -= ldig + 1
	n = n // 10
print(n)


data = input()
numbers = data.split()
num = int(numbers[0])
times = int(numbers[1])
for i in range(times):
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
print(int(num))


temp = input()
var = temp.split(' ')
n = int(var[0])
k = int(var[1])
if n >= 2 and n <= pow(10, 9) and (k >= 1) and (k <= 50):
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n /= 10
print(int(n))


from sys import stdin

def main():
	(x, y) = stdin_get_ints_from_line()
	for _ in range(y):
		if str(x).endswith('0'):
			x = x // 10
		else:
			x = x - 1
	print(x)

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
main()


(x, p) = map(int, input().split())
for _ in range(p):
	if x % 10 == 0:
		x = x // 10
	else:
		x = x - 1
print(x)


ed = input().split()
a = int(ed[0])
b = int(ed[1])
for k in range(b):
	if str(a)[-1] == '0':
		a = int(a / 10)
	elif str(a)[-1] != '0':
		a = a - 1
print(a)


nums = list(input().rstrip().split())
n = nums[0]
k = int(nums[1])
l = len(n)
nc = list(n)
for i in range(l - 1, -1, -1):
	if k == 0:
		break
	d = int(nc[i])
	if d == 0:
		k -= 1
		continue
	if d < k:
		k -= d + 1
	else:
		nc[i] = str(d - k)
		k = 0
		break
print(''.join(nc[0:i + 1]))


(a, c) = input().split()
b = int(a)
d = int(c)
m = 0
while m < d:
	if b % 10 == 0:
		b = b // 10
	else:
		b = b - 1
	m += 1
print(b)


import unittest

def tanya(n, k):
	while k > 0:
		ld = n % 10
		if ld > 0:
			if ld <= k:
				n -= ld
				k -= ld
			else:
				n -= k
				k = 0
		else:
			n = int(n / 10)
			k -= 1
	return n

class Test(unittest.TestCase):

	def test(self):
		self.assertEqual(tanya(1, 1), 0)
		self.assertEqual(tanya(7, 0), 7)
		self.assertEqual(tanya(512, 4), 50)
		self.assertEqual(tanya(1000000000, 9), 1)
import sys
(n, k) = map(int, sys.stdin.readline().split(' '))
print(tanya(n, k))


x = input()
(number, step) = x.split(' ')
number = int(number)
step = int(step)
while step:
	step -= 1
	if str(number)[-1] == '0':
		number //= 10
	else:
		number -= 1
print(number)


(a, b) = map(int, input().split())
while True:
	if b > 0:
		if a % 10 == 0:
			a = a // 10
			b = b - 1
			continue
		else:
			a = a - 1
			b = b - 1
			continue
	else:
		print(a)
		break


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


u = [int(a) for a in input().split(' ')]
integer = str(u[0])
for i in range(u[1]):
	if integer[-1] == '0':
		integer = integer[:-1]
	else:
		integer = str(int(integer) - 1)
print(integer)


import math as m
nums = input().split()

def sub1(num):
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
	return num
for i in range(int(nums[1])):
	nums[0] = sub1(int(nums[0]))
print(m.floor(nums[0]))


d = list(map(int, str(input()).split(' ')))
while d[1] > 0:
	if d[0] % 10 == 0:
		d[0] = int(d[0] / 10)
	else:
		d[0] = d[0] - 1
	d[1] -= 1
print(d[0])


inpt = input()
last = 0
value = inpt.split(' ')[1]
inpt = inpt.split(' ')[0]
inpt = int(inpt)
value = int(value)
while value > 0:
	last = inpt % 10
	if last == 0:
		inpt = int(inpt) / 10
		value = value - 1
	elif last < value:
		value = value - last
		inpt = inpt - last
	else:
		inpt = inpt - value
		value = 0
print(int(inpt))


string = input('')
stringArr = string.split(' ')
num = int(stringArr[0])
k = int(stringArr[1])
for i in range(k):
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
print(int(num))


def main():
	(n, k) = map(str, input().split())
	while int(k) > 0:
		n = str(n)
		if n[-1] != '0':
			n = int(n) - 1
		else:
			n = str(n)
			n = n[0:-1]
		k = int(k) - 1
	print(n)
main()


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


import sys

def solver(n, k):
	while k > 0:
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
		k -= 1
	return n

def get_ints():
	return map(int, sys.stdin.readline().split())
(a, b) = get_ints()
sys.stdout.write(str(solver(a, b)))


import sys
from sys import stdin, stdout
(a, b) = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(b):
	if a % 10 == 0:
		a = round(a / 10)
	else:
		a = a - 1
print(a)


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


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


a = input()
b = a.split()
v = len(b)
number = int(b[0])
times = int(b[1])
reference = 0
while reference < times:
	if number % 10 == 0:
		number = int(number / 10)
	else:
		number = int(number - 1)
	reference = reference + 1
print(number)


(a, b) = input().split()
a = int(a)
b = int(b)
s = 0
while s < b:
	if a % 10 == 0:
		a //= 10
	elif a % 10 != 0:
		a -= 1
	s += 1
print(a)


inp = input()
loc = inp.find(' ')
n = int(inp[:loc])
k = int(inp[loc:])
for i in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


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


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


(n, k) = input().split()
k = int(k)
n = list(map(int, list(n[::-1])))
while True:
	if k > n[0]:
		k -= n.pop(0) + 1
	else:
		n[0] -= k
		break
print(''.join(map(str, n[::-1])))


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


(n, time) = input().split()
time = int(time)
for i in range(0, time):
	l = len(n)
	if n[len(n) - 1] != '0':
		n = str(int(n) - 1)
	else:
		n = n[0:len(n) - 1]
print(n)


import sys
(a, b) = map(int, input().rstrip().split())
while b:
	if a % 10 != 0:
		a = a - 1
		b = b - 1
	else:
		a = a // 10
		b -= 1
print(a)


(num_in, amount_sub) = list(map(int, input().split()))
for loop in range(amount_sub):
	if num_in % 10 == 0:
		num_in /= 10
	else:
		num_in -= 1
print(int(num_in))


(num, nt) = map(int, input().split())
for i in range(nt):
	if num % 10 != 0:
		num = num - 1
	elif num % 10 == 0:
		num = num // 10
print(num)


data_in = input()
params = data_in.split(' ', 2)
n = int(params[0])
k = int(params[1])
for i in range(k):
	if str(n).endswith('0'):
		n = int(n / 10)
	else:
		n = n - 1
data_out = n
print(data_out)


inp = input('')
if not inp:
	exit()
(n, k) = inp.split(' ')
n = int(n)
k = int(k)
while k:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	k -= 1
print(int(n))


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


(number, times) = input().split()
(times, number) = (int(times), int(number))
while times > 0:
	if number % 10 != 0:
		number -= 1
	else:
		number /= 10
	times -= 1
print(int(number))


def main():
	(n, k) = map(int, input().split())
	if 2 <= n <= pow(10, 9) and 1 <= k <= 50:
		for i in range(k):
			if n % 10 != 0:
				n -= 1
			else:
				n /= 10
		print(int(n))
main()


raw_input = input()
n_str = raw_input.split(' ')
n = int(n_str[0])
k = int(n_str[1])
for index in range(k):
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


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


(nr, t) = map(int, input().split())
ans = nr
for i in range(1, t + 1):
	if ans % 10 == 0:
		nsr = str(ans)
		ans = int(nsr[:-1])
	else:
		ans = ans - 1
print(ans)


(n, k) = input().split()
k = int(k)
for i in range(len(n) - 1, -1, -1):
	if n[-1] is not '0':
		if int(n[-1]) >= k:
			n = n[0:-1] + str(int(n[-1]) - k)
			break
		else:
			k -= int(n[-1]) + 1
			n = n[0:-1]
	elif k is 0:
		break
	else:
		n = n[0:-1]
		k -= 1
print(n)


def main():
	(n, k) = [int(i) for i in input().split()]
	for i in range(k):
		if len(str(n)) > 1 and str(n)[-1] == '0':
			n = int(n / 10)
		else:
			n = n - 1
	print(n)
main()


try:
	(x, y) = input().split()
	y = int(y)
	while y > 0:
		temp = int(x[-1])
		if y > temp:
			y -= temp + 1
			x = x[:-1]
		else:
			temp -= y
			x = x[:-1]
			x = x + str(temp)
			y = 0
	print(x)
except:
	pass


def minus(n):
	s = str(n)
	if s[-1] == '0':
		return int(s[:len(s) - 1])
	else:
		return n - 1
(n, k) = map(int, input().split())
for i in range(k):
	n = minus(n)
print(n)


a = input().split()
num = int(a[0])
it = int(a[1])
res = 0
i = 0
while i != it:
	if str(num)[len(str(num)) - 1] != '0':
		num = int(num) - 1
	elif str(str(num)[len(str(num)) - 1]) == '0':
		num = int(int(num) / 10)
	i += 1
print(num)


(Num, Reps) = [int(x) for x in input().split()]
while Reps > 0:
	if Num % 10 == 0:
		Num = Num / 10
	else:
		Num = Num - 1
	Reps = Reps - 1
print(int(Num))


s = input()
a = s.split(' ')
nums = [int(x) for x in a]
sub = nums[0]
for x in range(nums[1]):
	if sub % 10 == 0:
		sub /= 10
	else:
		sub -= 1
print(int(sub))


import sys
inp = sys.stdin.readline()
inp = list(map(int, inp.split()))
n = inp[0]
k = inp[1]
for x in range(k):
	if n % 10:
		n = n - 1
	else:
		n = n / 10
print(int(n))


b = input().split()
for i in range(len(b)):
	a = int(b[0])
	s = int(b[1])
i = 0
while i < s:
	if a % 10 > 0:
		a -= 1
		i += 1
	else:
		a //= 10
		i += 1
print(a)


o = list(map(str, input().split()))
n = o[0]
k = o[1]
for i in range(int(k)):
	N = len(n)
	if n[N - 1] == '0':
		a = int(n)
		n = a // 10
	else:
		a = int(n)
		n = a - 1
	n = str(n)
print(n)


512
511
510
51
50
(n, k) = map(int, input().split())
for i in range(k):
	p = n % 10
	if p != 0:
		n -= 1
	else:
		n = n // 10
print(n)


s = input().split()
l = []
l.extend(s[0])
for i in range(0, int(s[1])):
	if int(l[-1]) != 0:
		l[-1] = int(l[-1]) - 1
	else:
		l.pop()
for i in l:
	print(i, end='')


(x, y) = input().split()
z = 0
x = int(x)
y = int(y)
res = 0
while y != z:
	if x % 10 == 0:
		x = x // 10
	else:
		x = x - 1
	z = z + 1
print(x)


def wrong_subtraction():
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	for _ in range(b):
		if a % 10 == 0:
			a = int(a / 10)
		else:
			a -= 1
	print(a)
wrong_subtraction()


while True:
	try:
		(n, k) = map(int, input().split())
		for _ in range(k):
			if n % 10 == 0:
				n /= 10
			else:
				n -= 1
		print(int(n))
	except EOFError:
		break


def line():
	return map(int, input().split())
(n, k) = line()
while k:
	v = min(n % 10, k)
	n -= v
	k -= v
	if k:
		n //= 10
		k -= 1
print(n)


(a, b) = map(int, input().split())
for x in range(b):
	c = str(a)
	if c[-1] != '0':
		a = a - 1
	elif c[-1] == '0':
		a = a // 10
print(a)


s = list(map(lambda x: int(x), input().split(' ')))
for _ in range(s[1]):
	p = str(s[0])
	if p[len(p) - 1] == '0':
		s[0] = int(s[0] / 10)
	else:
		s[0] = s[0] - 1
print(s[0])


import math
(n, k) = map(int, input().split())
z = math.floor(math.log10(n) + 1)
while k > 0:
	if n % 10 != 0:
		n = n - 1
	else:
		n = n // 10
	k -= 1
print(n)


def solve(arr):
	times = arr[1]
	first = arr[0]
	for i in range(times):
		if first % 10 != 0:
			first -= 1
		else:
			first /= 10
	print(int(first))
x = list(map(int, input().split()))
solve(x)


(n, k) = [int(i) for i in input().strip().split()]
n = [int(i) for i in str(n)]
while k > 0:
	if n[-1] == 0:
		k -= 1
		n.pop()
	elif k > n[-1]:
		k -= n[-1]
		n[-1] = 0
	elif n[-1] >= k:
		n[-1] -= k
		k = 0
print(''.join(list(map(str, n))))


(a, b) = input().split()

def minus_one(value):
	if value[-1] == '0':
		return str(int(int(value) / 10))
	else:
		return str(int(value) - 1)
for i in range(int(b)):
	a = minus_one(a)
print(a)


(n, k) = input().split()
iterations = 0
while iterations < int(k):
	if int(n) % 10 != 0:
		n = int(n) - 1
		iterations += 1
		if iterations == int(k):
			break
	if int(n) % 10 == 0:
		n = int(n) / 10
		iterations += 1
print(int(n))


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


(n, k) = map(lambda x: int(x), input().split(' '))
for i in range(k):
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print('{:.0f}'.format(n))


def solve(a, b):
	while b > 0:
		if a % 10 == 0:
			a /= 10
		else:
			a -= 1
		b -= 1
	return int(a)

def main():
	(n, k) = map(int, input().split())
	print(solve(n, k))
main()


(n, k) = map(int, input().split(' '))
for i in range(k):
	m = str(n)
	l = list(m)
	if m[-1] == '0':
		l.remove(m[-1])
		m = ''.join(l)
		n = int(m)
	else:
		n = n - 1
print(n)


(n, k) = input().split()
n = int(n)
for _ in range(int(k)):
	if n % 10 == 0:
		n //= 10
		continue
	n -= 1
print(n)


N = input().split(' ')
nn = int(N[0])
for i in range(int(N[1])):
	subb = str(nn)
	if int(subb[-1]) == 0:
		nn = nn // 10
	else:
		nn = nn - 1
print(nn)


import sys

def wrong_sub(number, n):
	for i in range(1, n + 1):
		if number % 10 == 0:
			number = number // 10
		else:
			number = number - 1
	return number
test_input = input().split(' ')
number = int(test_input[0])
n = int(test_input[1])
print(wrong_sub(number, n))


p = input()
p = p.split(' ')
p1 = int(p[0])
p2 = int(p[1])
for i in range(p2):
	if p1 % 10 == 0:
		p1 = p1 / 10
	else:
		p1 = p1 - 1
print(int(p1))


from sys import stdin as si

class Solution:

	def bazinga(self, s, k):
		while k > 0:
			if s % 10 == 0:
				s /= 10
			else:
				s -= 1
			k -= 1
		return int(s)
(m, n) = map(int, si.readline().strip().split())
S = Solution()
print(S.bazinga(m, n))


(n, x) = list(map(int, input().split(' ')))
for _ in range(x):
	n = n - 1 if n % 10 != 0 else n // 10
print(n)


def read_ints():
	return [int(elem) for elem in input().split(' ')]

def personal_subtract(list_inputs):
	for i in range(list_inputs[1]):
		if list_inputs[0] % 10 == 0:
			list_inputs[0] /= 10
		else:
			list_inputs[0] -= 1
	return int(list_inputs[0])
inputs = read_ints()
print(personal_subtract(inputs))


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


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


(n, k) = list(map(int, input().split()))
n = list(str(n))
for _ in range(k):
	if int(n[-1]) != 0:
		n[-1] = str(int(n[-1]) - 1)
	else:
		n.pop(-1)
print(''.join(n))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(n, k) = map(int, input().split())
for _ in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n /= 10
print(int(n))


import sys
n = 0
p = 0
iter = 0
number = 0
for l in sys.stdin:
	for k in l.split():
		k = int(k)
		if n == 0:
			number = k
			n = n + 1
		else:
			iter = k
	break
while iter > 0:
	if number % 10 != 0:
		number = number - 1
	else:
		number = number // 10
	numArr = []
	iter = iter - 1
print(number)


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


from random import randint
from math import *
(n, k) = map(int, input().split())
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


import sys

def main():
	(n, k) = [int(_) for _ in input().split()]
	for _ in range(k):
		last_digit = n % 10
		if last_digit == 0:
			n /= 10
		else:
			n -= 1
	print('{}'.format(int(n)))
sys.exit(main())


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


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


my_string = input().split(' ')
num = int(my_string[0])
k = int(my_string[1])
while k > 0:
	if num % 10 == 0:
		num = int(num / 10)
	else:
		num -= 1
	k -= 1
print(num)


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


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


(num, n) = [int(c) for c in input().split(' ') if len(c) > 0]
while n:
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
	n -= 1
print(num)


(number, times) = list(map(int, input().split()))
_tnumber = number
for i in range(times):
	last_digit = _tnumber % 10
	if last_digit != 0:
		_tnumber -= 1
	else:
		_tnumber = _tnumber // 10
print(_tnumber)


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


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


def vich(n):
	if n >= 10 and n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	return n
(n, k) = map(int, input().split())
for i in range(k):
	n = vich(n)
print(n)


t = input().split()
n = t[0]
k = int(t[1])
for i in range(0, k):
	last_digit = str(n)[len(str(n)) - 1]
	if last_digit != '0':
		n = int(n) - 1
	if last_digit == '0':
		n = int(int(n) / 10)
print(n)


from math import gcd, sqrt, ceil

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

def si():
	return input()

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

def li():
	return list(mi())
mod = 1000000000.0
(n, m) = mi()
while m:
	m -= 1
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(a, b) = [int(i) for i in input().split()]
while b > 0 and a > 0:
	if str(a)[-1] == '0':
		a = int(str(a)[:-1])
	else:
		a -= 1
	b -= 1
print(a)


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


(n, k) = list(map(int, input().strip().split()))
for j in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = n // 10
print(n, end='')


def ld(a):
	x = a % 10
	return x
(a, b) = map(int, input().split())
for i in range(b):
	if ld(a) != 0:
		a -= 1
	else:
		a //= 10
print(a)


(n, k) = input().split()
for i in range(int(k)):
	if n[len(n) - 1] == '0':
		n = n[0:len(n) - 1]
	else:
		n = n[0:len(n) - 1] + chr(ord(n[len(n) - 1]) - 1)
print(n)


import sys
numbers = [int(i) for i in sys.stdin.readline().split()]
n = numbers[0]
k = numbers[1]
i = 0
while i < k:
	if str(n)[-1] != '0':
		n -= 1
	else:
		n = int(n / 10)
	i += 1
print(n)


numbers = input().split(' ')
num = int(numbers[0])
timesToSub = int(numbers[1])
for i in range(timesToSub):
	if num / 10 - int(num / 10) == 0.0:
		num = int(num / 10)
	else:
		num -= 1
print(num)


def linear_search(array, item):
	for (idx, elem) in enumerate(array):
		if elem == item:
			return idx
	return -1

def binary_search(array, item):
	first = 0
	last = len(array) - 1
	while first <= last:
		midpoint = (first + last) // 2
		if array[midpoint] == item:
			return midpoint
		elif item < array[midpoint]:
			last = midpoint - 1
		else:
			first = midpoint + 1
	return -1

def argmax(array):
	max_idx = -1
	for (idx, elem) in enumerate(array):
		if max_idx == -1 or elem > array[max_idx]:
			max_idx = idx
	return max_idx

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

def input_int():
	return int(input())
(N, K) = input_list_int()
for _ in range(K):
	if N % 10 == 0:
		N = N // 10
	else:
		N = N - 1
print(N)


from itertools import accumulate, takewhile
from bisect import bisect_right
I = lambda : list(map(int, input().split()))
(n, k) = I()
while k > 0:
	if n % 10:
		c = min(k, n % 10)
		k -= c
		n -= c
	else:
		k -= 1
		n //= 10
print(n)


k = [int(i) for i in input().split()]
(number, operand, count) = (k[0], k[1], 0)
while count < operand:
	if number % 10 == 0:
		number = int(number / 10)
	else:
		number = number - 1
	count += 1
print(number)


local = False
if local:
	file = open('A.txt', 'r')

def inp():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def ints():
	return [int(_) for _ in inp().split()]
(n, k) = ints()
for i in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


from sys import stdin

def main():
	(number, k) = map(int, stdin.readline().strip().split())
	for i in range(k):
		if number <= 9:
			number -= 1
		elif str(number)[-1] != '0':
			number -= 1
		else:
			number = number // 10
	print(number)
main()


(a, n) = list(map(int, input().split()))
for i in range(n):
	c = str(a)[len(str(a)) - 1]
	if int(c) == 0:
		a /= 10
	else:
		a -= 1
	a = int(a)
print(a)


z = str(input())
a = ''
b = ''
c = 0
for i in z:
	if not i == ' ':
		a = a + i
	else:
		break
for i in z:
	if i == ' ':
		b = z[c:9999]
	c += 1
a = int(a)
b = int(b)
for i in range(b):
	if a % 10 == 0:
		a = a / 10
	else:
		a -= 1
print(int(a))


(n, k) = input().split()
k = int(k)
n = int(n)
u = n % 10
for s in range(k):
	if u != 0:
		n = int(n) - 1
		u = n % 10
	else:
		n = int(n) / 10
		u = n % 10
n = int(n)
print(n)


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


a = input().split()
num = int(a[0])
k = int(a[1])
a = 0
while a < k:
	if str(num)[-1] == '0':
		num = num // 10
	else:
		num -= 1
	a += 1
print(num)


zeile1 = input('')
eingabe = []
l = []
zahl = ''
for i in range(len(zeile1)):
	if zeile1[i] != ' ':
		zahl = zahl + zeile1[i]
	else:
		l.append(int(zahl))
		zahl = ''
	if i == len(zeile1) - 1:
		l.append(int(zahl))
		zahl = ''
n = l[0]
k = l[1]
while k > 0:
	t = str(n)
	if t[len(t) - 1] != '0':
		n -= 1
	else:
		n = int(n / 10)
	k -= 1
print(n)


def read():
	return int(input())

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

def readmap():
	return map(int, input().split())
(N, K) = readmap()
for i in range(K):
	if N % 10:
		N -= 1
	else:
		N = N // 10
print(N)


(N, K) = map(int, input().split())
for i in range(K):
	r = N % 10
	if r != 0:
		N = N - 1
	else:
		N = N // 10
print(N)


def f(num):
	a = int(num[-1])
	if a == 0:
		ans = num[0:-1]
	else:
		ans = num[0:-1] + str(a - 1)
	return ans
(num, n) = input().split()
for i in range(int(n)):
	num = f(num)
print(num)


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


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


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


(n, k) = input().split()
k = int(k)
while k:
	if n[-1] == '0':
		n = n[:-1]
		k -= 1
	else:
		sub = int(n[-1])
		if k > sub:
			k -= sub
			n = n[:-1] + '0'
		else:
			n = int(n) - k
			k -= k
print(max(int(n), 0))


from sys import stdin, stdout

def main():
	arr = [int(x) for x in stdin.readline().split()]
	for i in range(arr[1]):
		if arr[0] % 10 == 0:
			arr[0] = int(arr[0] / 10)
		else:
			arr[0] = int(arr[0] - 1)
	stdout.write(str(arr[0]))
main()


(n11, n) = map(int, input().split())
n1 = 1
while n1 <= n:
	n12 = str(n11)
	if n12[-1] == '0':
		n11 = int(n11) // 10
	else:
		n11 = n11 - 1
	n1 += 1
print(n11)


def getInt():
	return [int(i) for i in input().split(' ')]
(n, k) = getInt()
while k > 0:
	if n % 10:
		n -= 1
	else:
		n //= 10
	k -= 1
print(n)


a = list(map(int, input().split()))
x = a[0]
y = a[1]
z = 0
while z < y:
	m = x % 5
	n = x / 5
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
	z += 1
print(int(x))


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


(res, k) = input().split()
for _ in range(int(k)):
	if res[-1] != '0':
		res = int(res)
		res -= 1
		res = str(res)
	else:
		res = res[0:-1]
print(res)


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


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


nk = list(map(int, input().rstrip().split()))
for i in range(nk[1]):
	if nk[0] % 10 != 0:
		nk[0] = nk[0] - 1
	elif nk[0] % 10 == 0:
		nk[0] = nk[0] // 10
print(nk[0])


(num, n) = [int(s) for s in input().split()]
count = 0
while count != n:
	if num % 10 == 0:
		num = num // 10
		count += 1
	else:
		num -= 1
		count += 1
print(num)


(dig, steps) = map(int, input().split())
for i in range(0, steps):
	if dig % 10 != 0:
		dig = dig - 1
	else:
		dig = dig // 10
print(dig)


R = lambda : map(int, input().split())
(k, n) = R()
num = range(n)
num1 = k % 10
for i in num:
	if num1 == 0:
		k = k / 10
		num1 = k % 10
	else:
		k = k - 1
		num1 = k % 10
print(int(k))


(num, times) = input().split()
times = int(times)
for t in range(times):
	if num[len(num) - 1] == '0':
		num = int(num)
		num = num // 10
		num = str(num)
	else:
		num = int(num)
		num = num - 1
		num = str(num)
print(num)


get = input()
get = [int(x) for x in get.split(' ')]
for x in range(get[1]):
	if get[0] % 10 == 0:
		get[0] = get[0] / 10
	else:
		get[0] -= 1
print(int(get[0]))


f = 0
x = input()
f = x.find(' ')
n = int(x[:f])
k = int(x[f + 1:])
for i in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = n // 10
print(n)


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


(n, a) = map(int, input().split())
while a != 0:
	if a == 0:
		break
	else:
		s = str(n)
		if int(s[-1]) == 0:
			n = n // 10
			s = str(n)
			a -= 1
		else:
			n = n - 1
			s = str(n)
			a -= 1
print(n)


import sys
input = sys.stdin.readline

def main():
	(n, k) = map(int, input().split())
	for _ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	print(n)
main()


def wrong_subtract(nn):
	str_n = str(nn)
	if str_n[-1] != '0':
		nn -= 1
	if str_n[-1] == '0':
		nn = nn // 10
	return nn
(n, k) = [int(x) for x in input().split()]
for i in range(1, k + 1):
	n = wrong_subtract(n)
print(n)


class CF0977:

	def __init__(self):
		pass

	def solve(self):
		(n, k) = map(int, input().split())
		for i in range(k):
			if n % 10 == 0:
				n //= 10
			else:
				n -= 1
		print(n)
problem = CF0977()
problem.solve()


(n, t) = [int(i) for i in input().split()]
while t != 0:
	t -= 1
	l = [int(i) for i in str(n)]
	if l[-1] != 0:
		n -= 1
	else:
		n = n // 10
print(n)


import sys

def main():
	(n, k) = [int(x) for x in sys.stdin.readline().split()]
	for x in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n //= 10
	print('{:d}'.format(n))
main()


a = input().split()
b = list(a[0])
r = len(b)
c = int(a[1])
d = int(a[0])
i = 0
for i in range(c):
	v = list(str(d))
	r = len(v)
	k = int(v[r - 1])
	if k == 0:
		d = d // 10
	else:
		d = d - 1
print(d)


first_input = input()
(n, k) = first_input.split(' ')
n_int = int(n)
k_int = int(k)
answer = 0
for o in range(k_int):
	if n_int % 10 == 0:
		n_int = n_int / 10
	else:
		n_int = n_int - 1
n_int = int(n_int)
print(n_int)


def array_to_int(array):
	for i in range(len(array)):
		array[i] = int(array[i])
	return array
param = input().split(' ')
param = array_to_int(param)
for i in range(param[1]):
	if param[0] % 10 == 0:
		param[0] //= 10
	else:
		param[0] -= 1
print(param[0])


l = input().split(' ')
num = int(l[0])
k = int(l[1])

def nonZero(num):
	num = int(num)
	return num - 1

def zero(num):
	return str(num[:-1])
s = str(num)
for i in range(k):
	if s[-1] != '0':
		s = str(nonZero(s))
	else:
		s = str(zero(str(s)))
print(s)


a = input().split()
num = int(a[0])
t = int(a[1])
while t > 0:
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
	t -= 1
print(int(num))


(s, k) = input().split()
k = int(k)
f = 0
for i in range(k):
	if len(s) == 0:
		f = 1
		break
	if s[-1] == '0':
		s = s[:-1]
	else:
		s = s[:-1] + str(int(s[-1]) - 1)
if f == 1:
	print('0')
else:
	print(s)


def subtract_number(list_of_number, number_to_be_subtracted):
	if list_of_number[-1] >= number_to_be_subtracted:
		list_of_number[-1] = list_of_number[-1] - number_to_be_subtracted
		return list_of_number
	removed_no = list_of_number.pop()
	return subtract_number(list_of_number, number_to_be_subtracted - removed_no - 1)
list_of_input = input().split(' ')
list_of_number = list(map(int, list(list_of_input[0])))
number_to_be_subtracted = int(list_of_input[1])
list_of_number = subtract_number(list_of_number, number_to_be_subtracted)
for i in list_of_number:
	print(i, end='')


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


text = input()
num = text.split()[0]
step = int(text.split()[1])
while step:
	if num[-1] == '0':
		num = num[:len(num) - 1]
	else:
		temp = int(num)
		temp -= 1
		num = str(temp)
	step -= 1
print(num)


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


(n, k) = map(int, input().split())
regular = True
for _ in range(k):
	if str(n)[-1] == '0':
		regular = False
	else:
		regular = True
	if regular:
		n -= 1
	elif not regular:
		n //= 10
print(n)


def fif():
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	if k < 1 or k > 50:
		return False
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n -= 1
	print(int(n))
fif()


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


def solve():
	x = input().split(' ')
	a = x[0]
	b = int(x[1])
	cnt = 0
	while cnt < b:
		if a[-1] == '0':
			r = int(int(a) / 10)
			a = str(r)
		else:
			r = int(a) - 1
			a = str(r)
		cnt += 1
	return a
print(solve())


args = input()
x = int(args.split()[0])
y = int(args.split()[1])
while y > 0:
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
	y -= 1
print(int(x))


nums = input().split()
initial = int(nums[0])
times = int(nums[1])
results = []
results.append(initial)
for i in range(times):
	x = results[-1]
	if x % 10 == 0:
		results.append(x // 10)
	else:
		results.append(x - 1)
print(str(results[-1]))


def calculo():
	(numero, quantidade) = input().split(' ')
	numero = int(numero)
	quantidade = int(quantidade)
	for x in range(quantidade):
		if numero % 10 == 0:
			numero = numero / 10
		else:
			numero = numero - 1
		x = x + 1
	numero = int(numero)
	print(numero)
calculo()


arr = [int(i) for i in filter(None, input().split(' '))]
num = arr[0]
k = arr[1]
for i in range(k):
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
print(num)


(n, k) = map(int, input().split())
for _ in range(0, k):
	if n % 10 != 0:
		n = n - 1
	elif n % 10 == 0:
		n = n // 10
print(n)


def subtract(x, k):
	while k:
		if x % 10 != 0:
			x -= 1
		else:
			x = x // 10
		k -= 1
	return x
(n, k) = list(map(int, input().split()))
print(subtract(n, k))


(n, k) = input().split()
n = int(n)
k = int(k)

def getLastDigit(n):
	d = int(str(n)[-1])
	return d != 0
while k > 0:
	if getLastDigit(n):
		n = n - 1
	else:
		n = int(n / 10)
	k = k - 1
print(n)


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


def array_sort_part():
	arr = [11, 12, 1, 2, 3, 4, 3, 4]
	count = 0
	indxS = 0
	indxE = 0
	for i in range(len(arr)):
		c = 0
		iE = 0
		for j in range(len(arr)):
			if arr[i] < arr[j] and j - i == arr[j] - arr[i]:
				c += 1
				iE = j
		if count < c:
			count = c
			indxS = i
			indxE = iE
	print(count, indxS, indxE)

def main():
	(numb, count) = input().split()
	numb = int(numb)
	count = int(count)
	for i in range(count):
		if numb % 10 == 0:
			numb //= 10
		else:
			numb -= 1
	print(numb)
main()


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


def substraction(n, k):
	n = int(n)
	k = int(k)
	if (2 <= n and n <= pow(10, 9)) and (1 <= k and k <= 50):
		for i in range(0, k):
			if n != 0:
				if n % 10 == 0:
					n = int(n / 10)
				else:
					n = n - 1
			else:
				return 0
		return n
	else:
		return 'Error.'
(n, k) = input().split()
print(substraction(n, k))


def wrong_sub(n, k):
	for i in range(0, k):
		str_rep = str(n)
		if str_rep[-1] == '0':
			n = n // 10
		else:
			n = n - 1
	return n
nums = list(map(int, input().split()))
print(wrong_sub(nums[0], nums[1]))


import sys
inputedList = input().split()
if len(inputedList) < 2:
	sys.exit(-1)
n = int(inputedList[0])
k = int(inputedList[1])
for i in range(k):
	if n == 1:
		break
	if n % 10 > 0:
		n = n - 1
	elif n % 10 == 0:
		n = int(n / 10)
print(str(n))


n = [int(i) for i in input().split()]

def subraction(n):
	pom = [int(i) for i in str(n[0])]
	if pom[-1] != 0:
		n[0] -= 1
	if pom[-1] == 0:
		n[0] = int(n[0] / 10)
	n[1] -= 1
	if n[1] != 0:
		subraction(n)
subraction(n)
print(n[0])


def fun(n, k):
	i = k
	while i > 0:
		temp = n % 10
		if temp != 0:
			if temp <= i:
				n = n - temp
				i = i - temp
			else:
				n = n - i
				i = 0
		else:
			x = 0
			number = n
			count = 0
			while x == 0:
				x = number % 10
				number = int(number / 10)
				if x == 0:
					count += 1
			if count <= i:
				n = int(n / 10 ** count)
				i = i - count
			else:
				n = int(n / 10 ** i)
				i = 0
	return n
(n, k) = map(int, input().split())
print(fun(n, k))


import sys
fin = sys.stdin
fout = sys.stdout
(n, k) = map(int, next(fin).strip().split())

def decrease(num):
	return num // 10 if num % 10 == 0 else num - 1
for _ in range(k):
	n = decrease(n)
print(n, file=fout)


stdin = ''
stdin = input()
inlist = stdin.split()
num = int(inlist[0])
sub = int(inlist[1])
while sub > 0:
	if num % 10 == 0:
		num /= 10
		sub -= 1
	else:
		num -= 1
		sub -= 1
print(int(num))


def poopy(a, b):
	if b == 0:
		return a
	dig = int(a[-1])
	b -= dig + 1
	if b < 0:
		return a[0:-1] + str(dig - b - dig - 1)
	return poopy(a[0:-1], b)
poop = input('').split(' ')
print(poopy(poop[0], int(poop[1])))


inp = input().split(' ')
for x in range(int(inp[1])):
	if inp[0][-1:] == '0':
		inp[0] = inp[0][0:-1]
	else:
		inp[0] = inp[0][0:-1] + str(int(inp[0][-1:]) - 1)
print(inp[0])


(num, pos) = map(int, input().split())
list1 = []
while pos > 0:
	if num % 10 == 0:
		num = num // 10
	else:
		num = num - 1
	pos = pos - 1
print(num)


import sys
inp_str = input().split()
(n, k) = (inp_str[0], int(inp_str[1]))
lastDigit = 0
while k > 0:
	if n[-1] != '0':
		lastDigit = int(n[-1])
		if k > lastDigit:
			k -= lastDigit
			n = str(int(n) - lastDigit)
		else:
			print(int(n) - k)
			sys.exit()
	else:
		k -= 1
		n = n[:-1]
print(n)


in_text = input()
(num, ctr) = in_text.split(' ')
num = int(num)
ctr = int(ctr)
for i in range(ctr):
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
print(num)


In = input().split()
n = int(In[0])
k = int(In[1])
while k > 0:
	if str(n)[-1] == '0':
		n = n // 10
		k -= 1
		continue
	if str(n)[-1] != '0':
		n = n - 1
		k -= 1
print(n)


(nl, kl) = input().split()
n = list(nl)
k = int(kl)
for _ in range(k):
	l = len(n)
	if n[l - 1] == '0':
		ni = int(''.join(n))
		ni = ni // 10
		n = list(str(ni))
	else:
		ni = int(''.join(n))
		ni = ni - 1
		n = list(str(ni))
print(''.join(n))


(a, b) = map(int, input().split())
c = 0
for i in range(b):
	a1 = str(a)
	a2 = list(a1)
	w = len(a1)
	if a2[w - 1] == '0':
		a = a // 10
	else:
		a = a - 1
print(a)


def subtractions(n, k):
	while k > 0:
		if n % 10 != 0:
			n = n - 1
		else:
			n = n / 10
		k = k - 1
	return int(n)
(number, subtraction) = map(int, input().split())
print(subtractions(number, subtraction))


datos = input().split()
numero_cadena = datos[0]
numero_restas = int(datos[1])
i = numero_restas
digito = None
while i > 0:
	digito = int(numero_cadena[len(numero_cadena) - 1])
	if digito == 0:
		numero_cadena = numero_cadena[0:len(numero_cadena) - 1]
		i = i - 1
	elif i >= digito:
		i = i - digito
		numero_cadena = numero_cadena[0:len(numero_cadena) - 1] + '0'
	else:
		digito = digito - i
		i = 0
		numero_cadena = numero_cadena[0:len(numero_cadena) - 1] + str(digito)
print(numero_cadena)


(a, b) = input().split()
number = int(a)
k = int(b)
while k:
	if number % 10 == 0:
		number = number / 10
	else:
		number = number - 1
	k = k - 1
result = int(number)
print(result)


zr = '0'

def dc(x):
	if str(x)[-1] == zr:
		return x // 10
	else:
		x -= 1
		return x

def pc(x, k):
	for _ in range(k):
		x = dc(x)
	return x
(n, k) = [int(x) for x in input().split()]
print(pc(n, k))


(n, x) = [int(p) for p in input().split()]
while x > 0:
	if n % 10 != 0:
		n = n - 1
	elif n % 10 == 0:
		n = n // 10
	x = x - 1
print(n)


(a, b) = map(int, input().split())
while b != 0:
	tmp = a % 10
	if tmp == 0:
		a //= 10
		b -= 1
		continue
	a -= min(tmp, b)
	b -= min(tmp, b)
print(a)


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


def subtract(n):
	if n % 10 == 0:
		return n / 10
	return n - 1
(n, k) = input().split()
for _ in range(int(k)):
	n = subtract(int(n))
print(int(n))


(n, k) = input().split(' ')
n = int(n)
k = int(k)
count = 0
while count < k:
	if n % 10 == 0:
		n = n / 10
		count += 1
	elif n % 10 != 0:
		n -= 1
		count += 1
print(int(n))


import sys

def solve(l):
	n = l[1]
	val = l[0]
	for i in range(n):
		if val % 10 == 0:
			val = val // 10
		else:
			val -= 1
	return val
inputFile = sys.stdin.readlines()
for i in range(0, len(inputFile)):
	inputFile[i] = inputFile[i].rstrip()
inputFile = inputFile[0].split()
inputFile = list(map(int, inputFile))
print(solve(inputFile))


data = input()
(num, divisor) = data.split(' ')
num = int(num)
divisor = int(divisor)
for i in range(divisor):
	if num % 10 != 0:
		num -= 1
	else:
		num /= 10
print(int(num))


nK = input().split()
n = str(nK[0])
K = str(nK[1])
for i in range(int(K)):
	if n[len(n) - 1] == '0':
		n = n[:len(n) - 1]
	else:
		n = str(int(n) - 1)
print(n)


(n, k) = map(int, input().split())
stringn = str(n)
while k != 0:
	if stringn.endswith('0'):
		stringn = stringn[:-1]
		k = k - 1
	else:
		stringn = stringn[:-1] + str(int(stringn[-1:]) - 1)
		k = k - 1
print(int(stringn))


(a, b) = input().split()
a = list(a)
b = int(b)
for _ in range(b):
	if a[-1] == '0':
		a.pop()
	else:
		a[-1] = str(int(a[-1]) - 1)
	if not a:
		a = ['0']
print(''.join(a))


(num_bin, casos) = input().split()
numero_bin = int(num_bin)
j = 1
for i in range(0, int(casos)):
	if num_bin[-1] != '0':
		numero_bin -= 1
	else:
		numero_bin = int(numero_bin / 10)
	num_bin = str(numero_bin)
print(int(numero_bin))


(n, k) = map(int, input().split())
s = str(n)
for i in range(k):
	if s[-1] == '0':
		s = s[:-1]
		continue
	else:
		s = str(int(s) - 1)
print(s)


import sys

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

def solution():
	(n, k) = map(int, readline().split(' '))
	while k:
		if n % 10 != 0:
			n -= 1
		else:
			n //= 10
		k -= 1
	return n

def main():
	print(solution())
main()


from sys import stdout
(x, y) = map(int, input().split())

def tanya(n, k):
	for x in range(k):
		if n % 10 > 0:
			n = int(n - 1)
		else:
			n = int(n / 10)
	print(n)
tanya(x, y)


n = input()
x = n.split(' ')
i = 0
num = int(x[0])
while i < int(x[1]):
	if num > 0:
		if num % 10 == 0:
			num = num / 10
		else:
			num = num - 1
	i = i + 1
print('{:.0f}'.format(num))


(n, k) = map(str, input().split())
count = 0
while count < int(k):
	if n.endswith('0'):
		n = int(n) // 10
		n = str(n)
	else:
		n = int(n) - 1
		n = str(n)
	count += 1
print(n)


def sub():
	x = input().split(' ')
	l = list(map(lambda e: int(e), x))
	(n, k) = (l[0], l[1])
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n -= 1
	print(int(n))
sub()


input_a = input()
input_split = input_a.split()
number = int(input_split[0])
amount = int(input_split[1])
for i in range(amount):
	if number % 10 != 0:
		number -= 1
	else:
		number //= 10
print(number)


numbers = input()
(number, trials) = numbers.split(' ')
number = int(number)
trials = int(trials)
while trials > 0:
	if number % 10 == 0:
		number //= 10
	else:
		number -= 1
	trials -= 1
print(number)


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


def main():
	(x, y) = [int(x) for x in input().split()]
	while y:
		y -= 1
		i = x % 10
		if i == 0:
			x = int(x / 10)
		else:
			x = x - 1
	print(x)
main()


number = input()
number_list = number.split()
n = int(number_list[0])
time = int(number_list[1])
for t in range(time):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


def wrongSubtraction():
	values = input().split()
	number = int(values[0])
	for i in range(int(values[1])):
		if number % 10 == 0:
			number /= 10
		else:
			number -= 1
	print(int(number))
wrongSubtraction()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(n, k) = l()
while k > 0:
	if n % 10 == 0:
		n //= 10
		k -= 1
	else:
		n -= 1
		k -= 1
print(n)


def wrong_sub(n, count):
	for i in range(count):
		if n % 10 > 0:
			n -= 1
		else:
			n //= 10
	return n

def main():
	(n, count) = map(int, input().split())
	print(wrong_sub(n, count))
main()


(n, k) = input().split()
n = int(n)
k = int(k)

def tanyaSubtracts(x):
	if x % 10 == 0:
		newValue = x / 10
	else:
		newValue = x - 1
	return newValue
for i in range(k):
	answer = tanyaSubtracts(n)
	n = answer
n = int(n)
print(n)


l1 = list(map(int, input().split()))
while l1[1] > 0:
	if l1[0] % 10 > 0:
		l1[0] = l1[0] - 1
	else:
		l1[0] = l1[0] / 10
	l1[1] = l1[1] - 1
print(int(l1[0]))


l = input().split()
n = int(l[0])
t = int(l[1])
while t:
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	t -= 1
print(n)


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


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


(n, k) = map(int, input().split())
n1 = str(n)
myList = list(n1)
for counter in range(0, k):
	if int(myList[-1]) != 0:
		n = n - 1
		n1 = str(n)
		myList = list(n1)
	else:
		n = n // 10
		n1 = str(n)
		myList = list(n1)
print(n)


def subtract(n):
	if n % 10 == 0:
		return n // 10
	else:
		return n - 1
s = [int(n) for n in input().split(' ')]
n = s[0]
k = s[1]
for i in range(k):
	n = subtract(n)
print(n)


import collections

class Solution:

	def solve(self, n, k):
		for i in range(k):
			if n % 10 == 0:
				n //= 10
			else:
				n -= 1
		return n
sol = Solution()
[n, k] = list(map(int, input().strip().split()))
print(sol.solve(n, k))


x = input().split()
n = int(x[0])
k = int(x[1])
c = 0
while c != k:
	if n % 10 != 0:
		n = n - 1
	else:
		n = n // 10
	c = c + 1
print(n)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

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

def mi():
	return map(int, sys.stdin.readline().split())

def li():
	return list(map(int, sys.stdin.readline().split()))

def solve():
	(m, n) = mi()
	for _ in range(n):
		if m % 10 != 0:
			m -= 1
		else:
			m //= 10
	print(m)
solve()


n = input().split(' ')
number = int(n[0])
subtractions = int(n[1])
lastdigit = 0
while subtractions != 0:
	lastdigit = number % 10
	if lastdigit != 0:
		number -= 1
	elif lastdigit == 0:
		number = number // 10
	subtractions -= 1
print(number)


(g, h) = map(int, input().split())
for j in range(h):
	if g % 10 == 0:
		g = int(g / 10)
	else:
		g = int(g - 1)
print(g)


inp1 = str(input())
inp = inp1.split()
n = int(inp[0])
k = int(inp[1])
for i in range(k):
	a = n % 10
	if a != 0:
		n -= 1
	else:
		n //= 10
print(n)


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


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


def wrongSub(n, k):
	if k > 0:
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
		return wrongSub(n, k - 1)
	else:
		return n

def main():
	num = input()
	num = num.split()
	n = eval(num[0])
	k = eval(num[1])
	print(wrongSub(n, k))
main()


(n, k) = map(int, input().split())
s = 0
while s < k:
	st = str(n)
	if st[len(st) - 1] == '0':
		n //= 10
	else:
		n -= 1
	s += 1
print(n)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
for i in range(b):
	d = str(a)
	c = len(d)
	if d[c - 1] == '0':
		a = a // 10
	else:
		a = a - 1
print(a)


a = input()
b = a.split()
x = int(b[0])
y = int(b[1])
z = 0
while y - z > 0:
	z = z + 1
	if x % 10 == 0:
		x = int(x / 10)
	elif x % 10 != 0:
		x = int(x - 1)
if y - z == 0:
	print(x)


mylist = list(map(int, input().strip().split(' ')))[:2]
n = mylist[0]
k = mylist[1]
for x in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


(n, k) = map(int, input().rstrip().split())
while k > 0:
	n = str(n)
	if int(n[len(n) - 1]) == 0:
		n = int(n)
		n = n // 10
	else:
		n = int(n)
		n = n - 1
	k -= 1
print(int(n))


def wierdSubstract(n, k):
	for item in range(0, k):
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
	return n
(n, k) = map(int, input().split())
print(int(wierdSubstract(n, k)))


import math
[num, it] = list(map(int, input().split()))
for x in range(it):
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
print(math.floor(num))


def subtract_one(number):
	if float(number) % 10 == 0:
		result = number / 10
	else:
		result = number - 1
	return int(result)

def wrong_subtraction():
	(n, k) = map(int, input().split())
	for _ in range(k):
		n = subtract_one(n)
	print(n)
	return
wrong_subtraction()


def substract(number, amount):
	if int(number[-1]) + 1 == int(amount):
		print(number[:-1])
	elif int(number[-1]) + 1 > int(amount):
		print(number[:-1] + str(int(number[-1]) - int(amount)))
	else:
		substract(number[:-1], int(amount) - 1 - int(number[-1]))
i = input().split(' ')
substract(i[0], i[1])


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


inpt = input()
inpt = inpt.split()
n = inpt[0]
k = inpt[1]
for i in range(0, int(k)):
	if n[-1] != '0':
		n = str(int(n) - 1)
	elif n[-1] == '0':
		n = n[:-1]
	elif n[-1] == '':
		n = 0
print(int(n))


liczby = input().split()
liczba = int(liczby[0])
dzielenie = int(liczby[1])
x = ''
for i in range(dzielenie):
	if liczba % 10 == 0:
		liczba = liczba / 10
	else:
		liczba -= 1
print(int(liczba))


(a, b) = map(int, input().split())
for i in range(b):
	a = str(a)
	if a[len(a) - 1] == '0':
		a = int(a)
		a = int(a / 10)
	elif a[len(a) - 1] != 0:
		a = int(a)
		a -= 1
print(a)


def main():
	(N, K) = map(int, input().split())
	for i in range(1, K + 1):
		if N % 10:
			N -= 1
		else:
			N //= 10
	print(N)
main()


from sys import stdin
input = stdin.readline
(n, k) = map(int, input().split())
for _ in range(k):
	if str(n)[~0] == '0':
		n = int(str(n)[:-1])
	else:
		n -= 1
print(n)


(x, y) = input().split()
i = 0
x = int(x)
y = int(y)
while i < y:
	ldigit = x % 10
	if ldigit == 0:
		x = x / 10
	elif ldigit != 0:
		x = x - 1
	i += 1
print(int(x))


def subtraction(N, k):
	if k == 0:
		print(N)
	elif str(N)[-1] == '0':
		N = N // 10
		subtraction(N, k - 1)
	elif str(N)[-1] != '0':
		N -= 1
		subtraction(N, k - 1)
(N, k) = map(int, input().split())
subtraction(N, k)


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


import sys
input = sys.stdin.readline
(N, K) = map(int, input().split())
for _ in range(K):
	if N % 10 == 0:
		N //= 10
	else:
		N -= 1
print(N)


a = input()
b = a.split(' ')
nb = b[0]
k = int(b[1])
for i in range(k):
	if nb[-1] == '0':
		nb = nb[:-1]
	else:
		nb_int = int(nb)
		nb_int -= 1
		nb = str(nb_int)
print(nb)


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


linea = input()
lista = linea.split()
n = int(lista[0])
k = int(lista[1])
while k > 0:
	n_1 = n % 10
	if n_1 == 0:
		n = n // 10
	else:
		n = n - 1
	k = k - 1
if k == 0:
	print(str(n))


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


(nmbr, s) = input().split()
for i in range(int(s)):
	nmbr = int(nmbr)
	if nmbr % 10 == 0:
		nmbr = nmbr / 10
	else:
		nmbr = nmbr - 1
print(int(nmbr))


import os
import sys
arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
while k > 0:
	if n % 10 != 0:
		n = n - 1
		k = k - 1
	else:
		n = n / 10
		k = k - 1
print(int(n))


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


(n, count) = map(int, input().split())

def divide():
	global n
	if str(n)[len(str(n)) - 1] != '0':
		n -= 1
	else:
		n /= 10
		n = int(n)
while count > 0:
	divide()
	count -= 1
print(n)


def read_nums():
	return [int(x) for x in input().split()]

def main():
	(n, k) = read_nums()
	for _ in range(k):
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
	print(n)
main()


(numberInput, k) = input().split()
numberInput = int(numberInput)
for counter in range(int(k)):
	if numberInput % 10 == 0:
		numberInput = numberInput // 10
	else:
		numberInput -= 1
print(numberInput)


import sys
from collections import *
from math import *
import re

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def iseven(n):
	return [False, True][0 if n % 2 else 1]

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

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

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
(n, k) = inp()
while k:
	if n % 10 != 0:
		n -= 1
	else:
		n = n / 10
	k -= 1
print(int(n))


inp = list(input().split(' '))
k = int(inp[1])
check = inp[0]
integ = int(inp[0])
for i in range(0, k):
	if check[len(check) - 1] != '0':
		integ -= 1
	else:
		integ = int(integ / 10)
	check = str(integ)
print(integ)


(z, c) = map(int, input().split())
if 2 <= z <= 10 ** 9 and 1 <= c <= 50:
	for i in range(c):
		if z % 10 == 0:
			z /= 10
		else:
			z -= 1
	print(int(z))


(no, k) = map(int, input().split())
for a in range(1, k + 1):
	if no % 10 == 0:
		no = no // 10
	else:
		no = no - 1
print(no)


def solve():
	(num, n) = [int(x) for x in input().split()]
	for i in range(n):
		char = str(num)
		if char[-1] == '0':
			num = num // 10
		else:
			num -= 1
	print(num)
	return
solve()


def subt(num):
	if num % 10 != 0:
		return num - 1
	else:
		return num // 10
inp = str(input())
inp = inp.split(' ')
n = int(inp[0])
k = int(inp[1])
for i in range(k):
	n = subt(n)
print(n)


(num, k) = map(int, input().split(' '))
while k != 0:
	reminder = num % 10
	if reminder == 0:
		num = int(num / 10)
		k -= 1
	else:
		num -= min(k, reminder)
		k -= min(k, reminder)
print(num)


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


(a, b) = input().split()
for x in range(int(b)):
	a = str(a)
	a1 = int(a[len(a) - 1])
	if a1 == 0:
		a = int(a) // 10
	else:
		a = int(a) - 1
print(a)


(num, vzs) = [int(z) for z in input().split()]

def subtrai(num):
	novo = str(num)
	last = int(novo[len(novo) - 1])
	if last == 0:
		return int(num / 10)
	else:
		return num - 1
for i in range(vzs):
	num = subtrai(num)
print(num)


def main():
	(n, k) = tuple(map(int, input().strip(' ').split(' ')))
	while k > 0:
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
		k -= 1
	return int(n)
print(main())


(n, k) = (int(x) for x in input().split())
ans = n
i = 0
while i < k:
	d = ans % 10
	if d == 0:
		ans = ans // 10
		i += 1
	else:
		t = min(k - i, d)
		ans -= t
		i += t
print(ans)


x = input().split()
q = int(x[1])
c = 0
p = x[0]
while c < q:
	p = str(p)
	if p[-1] != '0':
		p = int(p)
		p -= 1
	else:
		p = int(p)
		p //= 10
	c += 1
print(p)


isVerbose = True

def verbosity(msg):
	if isVerbose:
		print(msg)
(n, k) = map(int, input().split())
for i in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


import sys
(num, k) = map(int, sys.stdin.readline().split())
while k > 0:
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
	k = k - 1
print(int(num))


def printArr(arr):
	for i in range(len(arr)):
		print('{}. {}'.format(i, arr[i]))
(n, k) = [int(x) for x in input().split()]
for _ in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(n, k) = map(int, input().split())
import math
for i in range(k):
	if str(n)[len(str(n)) - 1] == '0':
		n = math.floor(n / 10)
	else:
		n -= 1
print(n)


isDebug = False
(n, k) = input().split(' ')
n = int(n)
k = int(k)
for i in range(0, k):
	m = n % 10
	print(f'm={m}') if isDebug else ''
	if m == 0:
		n = int(n / 10)
	else:
		n = n - 1
	print(f'n={n}') if isDebug else ''
	print(f'-----') if isDebug else ''
print(f'{n}')


(m, n) = map(int, input().split())

def divisible_by_10(n):
	if n % 10 == 0:
		n /= 10
		return n
	else:
		return n - 1
i = 0
while i < n:
	m = divisible_by_10(m)
	i += 1
print(int(m))


import math
import string
s = str(input()).split()
a = int(s[0])
b = int(s[1])
for i in range(0, b):
	if a % 10 == 0:
		a //= 10
	else:
		a -= 1
print(a)


u = input()
l = list(map(int, u.split(' ')))
r = 0
n = l[0]
k = l[1]
if n // 10 == 0:
	print(n - k)
elif n // 10 > 0:
	while r < k:
		if n % 10 == 0:
			n = n / 10
		elif n % 10 != 0:
			n = n - 1
		r = r + 1
	print(int(n))


def main():
	i = 0
	(n, k) = map(int, input().split())
	while k > i:
		if n % 10 == 0:
			n = n // 10
		elif n % 10 != 0:
			n = n - 1
		i += 1
	print(n)
main()


(no, times) = map(int, input().split(' '))
for i in range(times):
	if no % 10 == 0:
		no = no // 10
	else:
		no = no - 1
print(no)


def int_strlist(x: list):
	for i in range(len(x)):
		x[i] = int(x[i])
	return x
x = int_strlist(input().split())
for _ in range(x[1]):
	if str(x[0])[-1] == '0':
		x[0] //= 10
	else:
		x[0] -= 1
print(x[0])


def wrong_sub(num, times):
	while times > 0:
		times -= 1
		last_dig = num % 10
		if last_dig == 0:
			num = num // 10
		else:
			num -= 1
	return num
(num, times) = input().split()
print(wrong_sub(int(num), int(times)))


(x, y) = map(int, input().split())
xx = str(x)[::-1]
ans = []
for i in xx:
	if y > 0:
		ii = int(i)
		if y >= ii + 1:
			y -= ii + 1
		elif ii == 0:
			y -= 1
		else:
			leave = str(ii - y)
			y = 0
			ans.append(leave)
	else:
		ans.append(i)
print(''.join(ans[::-1]))


(num, time) = map(int, input().split())
for t in range(time):
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
print(int(num))


a = input().split()
init = int(a[0])
iters = int(a[1])
i = 1
while i <= iters:
	if str(init)[-1:] == '0':
		i += 1
		init = int(init / 10)
	else:
		init = init - 1
		i += 1
print(init)


(a, b) = [int(a) for a in input().split()]
while b > 0:
	if a % 10 == 0:
		a /= 10
	elif a % 10 != 0:
		a = a - 1
	b -= 1
print(int(a))


from sys import stdin

def get_user_input():
	(a, b) = map(str, stdin.readline().rstrip().split())
	return (a, b)
(n, k) = get_user_input()
k = int(k)
temp_n = ''
for i in range(k):
	if n[len(n) - 1] == '0':
		n = n[0:len(n) - 1]
	else:
		last_num = int(n[len(n) - 1]) - 1
		temp_n = n[0:len(n) - 1]
		temp_n += str(last_num)
		n = temp_n
print(n)


a = input().split()
target = int(a[0])
times = int(a[1])
for x in range(times):
	if target % 10 == 0:
		target = int(target / 10)
	else:
		target -= 1
print(target)


lst = input().split()
a = float(lst[0])
b = int(lst[1])
for i in range(b):
	if (a / 10).is_integer():
		a /= 10
	else:
		a -= 1
print(int(a))


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


entrada = input()
(n, k) = entrada.split(' ')
l = len(n)
result = int(n)
k = int(k)
for i in range(l):
	temp = int(n[l - i - 1]) - k
	if int(n[l - i - 1]) == 0:
		result = result // 10
		k -= 1
	elif temp > 0:
		result -= k
		break
	elif temp == -1:
		result = result // 10
		break
	elif temp < -1:
		result = result // 10
		k -= int(n[l - i - 1]) + 1
	elif temp == 0:
		result -= result % 10
		break
print(result)


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


(n, k) = list(map(int, input().split()))
sub = lambda x: x // 10 if x // 10 == x / 10 else x - 1
for i in range(k):
	n = sub(n)
print(n)


(n, k) = map(int, input().split())

def solution(n, k):
	for i in range(k):
		s = str(n)
		if len(str(n)) == 1:
			n -= 1
		elif s[-1] != '0':
			n -= 1
		elif s[-1] == '0':
			n = n // 10
	return n
print(solution(n, k))


(number, pases) = map(int, input().split())
for i in range(pases):
	if number % 10:
		number -= 1
	else:
		number //= 10
print(number)


from sys import stdin, stdout

def fn(n, k):
	if k == 0:
		return n
	if n % 10 != 0:
		return fn(n - 1, k - 1)
	return fn(n // 10, k - 1)
for _ in range(1):
	(n, k) = list(map(int, stdin.readline().split()))
	print(fn(n, k))


(n, k) = [int(x) for x in input().split()]
n = str(n)
for i in range(k):
	l = list(n)
	if l[-1] == '0':
		del l[-1]
		n = ''.join(l)
	else:
		n = str(int(n) - 1)
print(n)


a = input().split()
c = int(a[0])
n = int(a[1])
while n != 0:
	if c % 10 != 0:
		c -= 1
	else:
		c = c // 10
	n -= 1
print(c)


(num, tim) = input().split(' ')
(num, tim) = (int(num), int(tim))
for i in range(tim):
	if str(num)[len(str(num)) - 1] == '0':
		num = int(num / 10)
	else:
		num = num - 1
print(num)


from sys import stdin, stdout

def main():
	inp = [int(x) for x in stdin.readline().split()]
	while inp[1] > 0:
		if inp[0] % 10 != 0:
			inp[0] -= 1
		else:
			inp[0] /= 10
		inp[1] -= 1
	stdout.write(str(int(inp[0])))
main()


(n, k) = input().split(' ')
en = int(n)
kay = int(k)
i = 0
while i < kay:
	if en % 10 == 0:
		en = en / 10
	else:
		en = en - 1
	i += 1
print(int(en))


(n, k) = map(int, input().split())
i = 1
while i < k + 1:
	rem = n % 10
	if rem > 0:
		n = n - 1
	elif rem == 0:
		n = n // 10
	i = i + 1
print(n)


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


import math
(n, k) = map(int, input().split())

def minus(n):
	lastNum = n % 10
	if lastNum > 0:
		n -= 1
	else:
		n /= 10
	return int(n)
i = 0
while i < k:
	n = minus(n)
	i += 1
print(n)


(n, k) = input().split()
n = list(n)
k = int(k)
while k > 0 and len(n) > 1:
	if n[-1] == '0':
		n.pop()
		k -= 1
	else:
		k -= 1
		n[-1] = str(int(n[-1]) - 1)
if len(n) == 1:
	n[0] = str(int(n[0]) - k)
print(''.join(n))


ttstr = input()
k = int(ttstr[-2] + ttstr[-1])
n = int(ttstr[0:-2])
for i in range(k):
	if n <= 0:
		n = 0
	elif n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


L = list(map(int, input().split()))
x = L[0]
b = L[1]
while b != 0:
	if x % 10 == 0:
		x = x / 10
	else:
		x -= 1
	b -= 1
print(int(x))


(n, k) = [int(i) for i in input().split()]
for i in range(k):
	tmp = str(n)
	if tmp[-1] != '0':
		n -= 1
	elif tmp[-1] == '0':
		n //= 10
print(n)


def string_to_list(count, str_):
	arr = []
	char_index = 0
	word = ''
	for arr_index in range(count):
		while not (char_index >= len(str_) or str_[char_index] == ' '):
			word += str_[char_index]
			char_index += 1
		arr.append(word)
		word = ''
		char_index += 1
	return arr

def tanyas_counting(n, k):
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n //= 10
	return n
arr = string_to_list(2, input())
n = int(arr[0])
k = int(arr[1])
print(tanyas_counting(n, k))


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


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


import math
import cmath
(n, k) = map(int, input().split())
for _ in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n -= 1
print(n)


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N, K):
	for i in range(K):
		d = N % 10
		if d > 0:
			N -= 1
		else:
			N //= 10
	return N
(N, K) = map(int, input().split())
print(solve(N, K))


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


a = input()
c = ''
l = len(a)
for i in range(0, l):
	if a[i] == ' ':
		m = a[i:l]
		break
	c += a[i]
k = int(c)
subs = int(m)
for i in range(0, subs):
	if k % 10 != 0:
		k = k - 1
	else:
		k = int(k / 10)
print(k)


(num, k) = input().split()

def wrong_sub(n):
	if len(n) > 1:
		if n[-1] != '0':
			n = int(n) - 1
		elif n[-1] == '0':
			n = int(n) // 10
	else:
		n = int(n) - 1
	return n
for i in range(0, int(k)):
	final = wrong_sub(num)
	num = str(final)
print(final)


ini = input()
lst = ini.split()
lst = [int(i) for i in lst]
for _ in range(lst[1]):
	if lst[0] % 10 == 0:
		lst[0] = lst[0] / 10
	else:
		lst[0] -= 1
print(int(lst[0]))


import sys
args = input().split()
n = int(args[0])
k = int(args[1])
while n:
	m = n % 10
	if m >= k:
		print(n - k)
		break
	k = k - (m + 1)
	n = int(n / 10)


(n, k) = input().split()
k = int(k)

def main(k, n):
	for (i, e) in enumerate(reversed(n)):
		v = int(e)
		if k <= v:
			return n[:len(n) - i - 1] + str(v - k)
		else:
			k -= v + 1
print(main(k, n))


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


def find(m, n):
	while n != 0:
		x = m % 10
		if x > 0:
			m = m - 1
		else:
			m = m // 10
		n = n - 1
	print(m)
a = list(map(int, input().split()))
find(a[0], a[1])


vl = input().split(' ')
nmb = int(vl[0])
for i in range(int(vl[1])):
	if nmb % 10 == 0:
		nmb = nmb / 10
	else:
		nmb -= 1
print(int(nmb))


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


n = input()
n = n.split(' ')
k = int(n[1])
n = int(n[0])
while k < 1 or k > 50 or n < 2 or (n > 10000000000.0):
	n = input()
	n = n.split(' ')
	k = int(n[1])
	n = int(n[0])
l = str(n)
i = 0
while i < k:
	i += 1
	if l[len(l) - 1] != '0':
		n = n - 1
		l = str(int(n))
		continue
	elif l[len(l) - 1] == '0':
		n = n / 10
		l = str(int(n))
print(int(n))


s = str(input())
l = list(s.split(' '))
n = int(l[0])
k = int(l[1])
while k > 0:
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n = n - 1
	k -= 1
	if n == 0:
		break
print(n)


masukan = [int(y) for y in input().split()]
for i in range(masukan[1]):
	if masukan[0] % 10 == 0:
		masukan[0] = masukan[0] / 10
	else:
		masukan[0] -= 1
print('%.0f' % masukan[0])


def sub(n):
	if n % 10 != 0:
		return n - 1
	else:
		return n // 10
(a, b) = map(int, input().split())
for i in range(b):
	a = sub(a)
print(a)


(x, y) = map(int, input().split())
for a in range(y):
	if x % 10 == 0:
		x = x / 10
		continue
	else:
		x = x - 1
print(int(x))


(m, n) = map(str, input().split())
for i in range(int(n)):
	v = len(m)
	t = int(m)
	if int(m[v - 1]) == 0:
		t = int(t / 10)
	else:
		t = t - 1
	m = str(t)
print(m)


x = input()
y = x.split()
p = []
for i in y:
	i = int(i)
	p.append(i)
x = p[0]
for i in range(p[1]):
	if x % 10 != 0:
		x -= 1
	else:
		x //= 10
print(x)


(x, y) = map(int, input().split())
for _ in range(y):
	x = x - 1 if x % 10 else x // 10
print(x)


from sys import stdin
(n, k) = map(int, stdin.readline().split())
for i in range(k):
	d = n % 10
	if d == 0:
		n //= 10
	else:
		n -= 1
print(n)


(a, b) = map(int, input().split())
c = a
k = 1
while k <= b:
	c = list(str(a))
	if c[-1] != '0':
		a = a - 1
	else:
		a = int(a / 10)
	k += 1
print(a)


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


inputs = input()
inputs_mod = inputs.split()
n = int(inputs_mod[0])
k = int(inputs_mod[1])
while k > 0:
	last_digit = n % 10
	if last_digit == 0:
		n /= 10
	else:
		n -= 1
	k -= 1
print(int(n))


import sys
lines = sys.stdin.readlines()[0].split(' ')
prototype = lines[0]
for i in range(0, int(lines[1])):
	if prototype[-1] == '0':
		prototype = prototype[:-1]
	else:
		prototype = str(int(prototype) - 1)
print(prototype)


e = [int(x) for x in input().split(' ')]
e[0] = list(map(int, str(e[0])))
for i in range(e[1]):
	if e[0][-1] != 0:
		e[0][-1] -= 1
	elif e[0][-1] == 0:
		e[0].pop()
print(''.join(map(str, e[0])))


(num, k) = input().split()
num = int(num)
for count in range(0, int(k)):
	if str(num)[-1] == '0':
		num //= 10
	else:
		num -= 1
print(num)


def main(m, n):
	new_m = m
	for i in range(n):
		if new_m % 10 == 0:
			new_m = new_m / 10
		else:
			new_m = new_m - 1
	return int(new_m)
try:
	while True:
		(m, n) = list(map(int, input().split()))
		print(main(m, n))
except:
	pass


import typing

def ri(*args) -> typing.Iterator:
	(func, funcs) = (int, (int, float, str))
	sep = ' '
	for a in args:
		if a in funcs:
			func = a
		elif isinstance(a, str):
			sep = a
	return map(func, input().strip().split(sep))

def main():
	(n, k) = ri()
	while k:
		k -= 1
		r = n % 10
		if r > 0:
			n -= 1
		else:
			n //= 10
	print(n)
main()


import sys
input = lambda : sys.stdin.readline().rstrip()

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


def func(n, k):
	while k > 0:
		if str(n)[-1] == '0':
			n = int(n) // 10
		else:
			n -= 1
		k -= 1
	return n
(n, k) = map(int, input().split())
print(func(n, k))


(a_, b_) = map(int, input().split())
for _ in range(b_):
	if str(a_).endswith('0'):
		a_ = a_ // 10
	else:
		a_ -= 1
print(a_)


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


p = input().rstrip().split(' ')
x = list(p[0])
y = int(p[1])
for i in range(0, y):
	if x[len(x) - 1] == '0':
		del x[len(x) - 1]
	else:
		P = ''.join(x)
		C = int(P) - 1
		x = list(str(C))
print(''.join(x))


(n, k) = map(int, input().split())
temp_number = list(str(n))
number = []
for elem in temp_number:
	number.append(int(elem))
for _ in range(k):
	if number[len(number) - 1] == 0:
		number.pop()
	else:
		number[len(number) - 1] -= 1
print(''.join((str(x) for x in number)))


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


numbers = [int(n) for n in input().split()]
number = numbers[0]
numofsubs = numbers[1]
for i in range(numofsubs):
	if number % 10 != 0:
		number -= 1
	else:
		number //= 10
print(number)


problema = input().split()
numero = int(problema[0])
veces = int(problema[1])
for x in range(1, veces + 1):
	if numero % 10 != 0:
		numero -= 1
	else:
		numero = numero / 10
else:
	print(int(numero))


inp_numbers = input()
(n, k) = map(int, inp_numbers.split(' '))
for iteration in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n -= 1
print(n)


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


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


x = input('')
m = x.split()
n = int(m[0])
k = int(m[1])
if n >= 2 and n <= 10 ** 9:
	if k >= 1 and k <= 50:
		for i in range(0, k):
			if n % 10 == 0:
				n = n / 10
			else:
				n = n - 1
print(int(n))


def jan(n, k):
	while k > 0:
		if n[-1] != '0':
			n = str(int(n) - 1)
			k -= 1
		else:
			n = str(int(n) // 10)
			k -= 1
	return int(n)
n1 = list(input().split())
n = str(n1[0])
k = int(n1[1])
print(jan(n, k))


try:
	(x, y) = map(str, input().split())
	x = list(map(int, x))
	for i in range(int(y)):
		if x[len(x) - 1] == 0:
			x.remove(x[len(x) - 1])
		else:
			x[len(x) - 1] -= 1
	for i in x:
		print(i, end='')
except:
	pass


q = lambda : map(int, input().split())
(n, k) = q()
for i in range(k):
	if str(n)[-1] == '0':
		n //= 10
	else:
		n -= 1
print(n)


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


import sys
for line in sys.stdin:
	params = line.rstrip().split()
	n = int(params[0])
	k = int(params[1])
	for i in range(k):
		if n > 0:
			if n % 10 != 0:
				n = n - 1
			else:
				n = int(n / 10)
	print(str(n))


num = list(map(int, input().rstrip().split()))
cont = 0
while cont < num[1]:
	if num[0] % 10 == 0 and cont < num[1]:
		num[0] /= 10
		cont += 1
	else:
		num[0] -= 1
		cont += 1
print(int(num[0]))


import math
s = input().split()
num = int(s[0])
k = int(s[1])
for number in range(k):
	last_digit = num % 10
	if last_digit == 0:
		num /= 10
	if last_digit < 10 and last_digit != 0:
		num -= 1
print(math.floor(num))


import sys

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


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


inHandle = input().split(' ')
sub = int(inHandle[0])
for i in range(int(inHandle[1])):
	if sub % 10 == 0:
		sub = sub / 10
	else:
		sub -= 1
print(int(sub))


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


def fun1(num, k):
	for _ in range(k):
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
	return int(num)

def sol():
	(num, k) = input().split(' ')
	(num, k) = (int(num), int(k))
	print(fun1(num, k))
sol()


n = input().split(' ')
total = int(n[0])
for i in range(int(n[1])):
	if n[0][len(n[0]) - 1] != '0':
		total -= 1
		n[0] = str(total)
	elif n[0][len(n[0]) - 1] == '0':
		total //= 10
		n[0] = str(total)
print(total)


import sys
lines = []
for line in sys.stdin:
	lines.append(line.rstrip('\n'))
number = int(lines[0].split(' ')[0])
iterations = int(lines[0].split(' ')[1])
for i in range(iterations):
	if number % 10 == 0:
		number = number / 10
	else:
		number -= 1
print(int(number))


def subb(num, k):
	if k == 0:
		return int(num)
	elif num[-1] == '0':
		return subb(str(int(num) // 10), k - 1)
	else:
		return subb(str(int(num) - 1), k - 1)

def main():
	(n, k) = input().split()
	print(subb(n, int(k)))
main()


lst = list(map(str, input().split()))
(a, b) = (lst[0], lst[1])
yo = int(a)
yo2 = int(b)
while yo2 > 0:
	if yo % 10 == 0:
		yo //= 10
		yo2 -= 1
	else:
		yo -= 1
		yo2 -= 1
print(yo)


(a, b) = map(int, input().split())
num = list(str(a))
for i in range(b):
	if int(num[-1]) != 0:
		num[-1] = int(num[-1]) - 1
	else:
		num.pop()
print(''.join(list(map(str, num))))


inputx = input()
number = inputx.split(' ')
counter = 1
result = number[0]
while counter <= int(number[1]):
	if int(result) % 10 == 0:
		result = int(result) / 10
		counter += 1
	else:
		result = int(result) - 1
		counter += 1
else:
	print(int(result))


def main():
	(n, k) = map(int, input().split())
	print(subtract_wrong(n, k))

def subtract_wrong(n, k):
	while k > 0:
		if not n % 10:
			n = n // 10
		else:
			n -= 1
		k -= 1
	return n
main()


(x1, y1) = input().split(' ')
(x, y) = (int(x1), int(y1))
for i in range(int(y)):
	if x % 10 == 0:
		x = x / 10
	else:
		x -= 1
print(int(x))


(n, k) = [int(s) for s in input().split(' ')]
sayac = 0
while sayac != k:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	sayac += 1
print(int(n))


input_of_pc = input().split()
first = int(input_of_pc[0])
times = int(input_of_pc[1])
while times != 0:
	if first % 10 == 0:
		first = first / 10
		times -= 1
	else:
		first -= 1
		times -= 1
print(round(first))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	(N, K) = Scanner.map_int()
	for _ in range(K):
		if N % 10 == 0:
			N //= 10
		else:
			N -= 1
	print(N)
	return
main()


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


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


from __future__ import print_function, division
from sys import stdin
dec = lambda a: a - 1 if a % 10 != 0 else a // 10
(a, k) = map(int, stdin.readline().split())
for _ in range(k):
	a = dec(a)
print(a)


l = [int(x) for x in input().split()]
s = str(l[0])
k = l[1]
while k != 0:
	if s[-1] == '0':
		s = str(int(s) // 10)
	else:
		s = str(int(s) - 1)
	k -= 1
print(s)


import os
import sys
from sys import stdin, stdout
from io import BytesIO, IOBase
mod = int(1000000000.0) + 7
intn = lambda : int(stdin.readline())
strs = lambda : stdin.readline()[:-1]
lstr = lambda : list(stdin.readline()[:-1])
mint = lambda : map(int, stdin.readline().split())
lint = lambda : list(map(int, stdin.readline().split()))
out = lambda x: stdout.write(str(x) + '\n')
out_ = lambda x: stdout.write(str(x) + ' ')

def main():
	(n, k) = mint()
	while k > 0:
		r = n % 10
		if r != 0:
			if k > r:
				n -= r
				k -= r
			else:
				n -= k
				k = 0
		else:
			n //= 10
			k -= 1
	out(n)
main()


ans = input()
(num, times) = ans.split(' ')
n = 0
while n < int(times):
	if int(num) % 10 == 0:
		num = int(num) / 10
		n += 1
	else:
		num = int(num) - 1
		n += 1
print(int(num))


import sys
(a, k) = input().split()
a = int(a)
k = int(k)
for i in range(0, k):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


(n, k) = map(int, input().split())
a = []
while n > 0:
	a.append(n % 10)
	n = n // 10
s = 0
for i in range(len(a)):
	s = s + a[i] + 1
	if s <= k:
		a[i] = -1
	else:
		s = s - a[i]
		for j in range(s, k + 1):
			a[i] = a[i] - 1
		break
a = a[::-1]
for i in range(len(a)):
	if a[i] == -1:
		break
	print(a[i], end='')


(s, n) = map(int, input().split())
while n > 0:
	n -= 1
	if str(s)[-1] == '0':
		s = int(str(s)[:-1])
	else:
		s -= 1
print(s)


def subAlgo(number, count):
	while count > 0:
		count = count - 1
		if number % 10 == 0:
			number = number // 10
		else:
			number = number - 1
	print(number)
a = list(map(int, input().split()))
subAlgo(a[0], a[1])


l = [i for i in map(int, input().split())]
while l[1] > 0:
	if l[0] % 10 == 0:
		l[0] = l[0] // 10
	else:
		l[0] = l[0] - 1
	l[1] -= 1
print(l[0])


import sys

def listToString(x):
	str1 = ''
	for ele in x:
		str1 += ele
	return str1
enteros = list()
lines = sys.stdin.readlines()
for linea in lines:
	c = linea.split()
	c = list(map(int, c))
	enteros.append(c)
x = enteros[0]
x = x[0]
y = enteros[0]
y = y[1]
for k in range(y):
	x = str(x)
	y = list(x)
	if y[-1] == '0':
		y.pop(-1)
		x = listToString(y)
	else:
		x = int(x)
		x = x - 1
print(x)


import math
[num, k] = map(int, input().split(' '))
for _ in range(k):
	(q, r) = divmod(num, 10)
	if r > 0:
		num -= 1
	else:
		num = q
print(num)


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


(n, k) = input().split(' ')
n = list(map(int, n))
for i in range(int(k)):
	if n[-1] != 0:
		n[-1] = int(n[-1]) - 1
	else:
		n = n[:len(n) - 1]
for i in n:
	print(i, end='')


def solution(n, k):
	for x in range(0, k):
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
	print(int(n))
(n, k) = tuple(map(int, input().split()))
solution(n, k)


a = input()
n = int(a.split(' ')[0])
k = int(a.split(' ')[1])

def Tanya(n, k):
	while k > 0 and n > 1:
		if n <= 1:
			pass
		elif n % 10 != 0:
			n = int(n - 1)
		else:
			n = int(n / 10)
		k = k - 1
	print(n)
Tanya(n, k)


(number, count, *_) = map(int, input().split(' '))
for _ in range(count):
	if number % 10 == 0:
		number /= 10
		number = int(number)
	else:
		number -= 1
print(number)


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


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


queries = [int(i) for i in input().split()]
number = queries[0]
q = queries[1]
for i in range(q):
	lastdigit = number % 10
	if lastdigit != 0:
		number -= 1
	if lastdigit == 0:
		number /= 10
print(int(number))


(a, b) = [int(x) for x in input().split()]
cont = 0
while cont < b:
	if str(a)[-1] == '0':
		a = a // 10
	else:
		a -= 1
	cont += 1
print(a)


a = list(map(int, input().split()))
x = a[0]
i = 0
while i < a[1]:
	if x % 10 == 0:
		x = x / 10
	else:
		x = x - 1
	i = i + 1
print(round(x))


(number, number_of_subtractions) = map(int, input().split())
for value in range(number_of_subtractions):
	if number % 10 != 0:
		number = number - 1
	else:
		number = number // 10
print(number)


(m, n) = map(int, input().split())
count = 0
while count != n:
	reminder = m % 10
	if reminder > 0:
		m = m - 1
		count += 1
	elif reminder == 0:
		m = m / 10
		count += 1
print(int(m))


def wrong_subtraction():
	import math
	arr = input().split(' ')
	n = int(arr[0])
	k = int(arr[1])
	if 2 <= n <= 10 ** 9 and 1 <= k <= 50:
		for i in range(1, k + 1):
			if math.modf(n / 10)[0] == 0:
				n = n / 10
			else:
				n = n - 1
		return int(n)
	else:
		raise ValueError('Wrong Input range')
number = wrong_subtraction()
print(number)


(A, K) = input().split()
K = int(K)
A = list(map(int, list(A)))
for k in range(K):
	if A[-1] != 0:
		A[-1] -= 1
	else:
		A.pop()
print(''.join(map(str, A)))


from sys import stdin

def solve(tc):
	(n, k) = map(int, stdin.readline().split())
	for i in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	print(n)
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


l = input().split()
(n, k) = (list(map(int, l[0])), int(l[1]))
for i in range(k):
	if n[-1] > 0:
		n[-1] = n[-1] - 1
	else:
		n.pop(-1)
for item in n:
	print(item, end='')


values = input().split()
(number, times) = (int(values[0]), int(values[1]))
for time in range(times):
	if number % 10 == 0:
		number = number // 10
	else:
		number -= 1
print(number)


l = input().split()
c = int(l[0])
e = int(l[1])
a = 0
while a < e:
	a += 1
	if c % 10 == 0:
		c //= 10
	else:
		c -= 1
print(c)


a = list(map(int, input().rstrip().split()))
n = a[0]
k = a[1]
while k > 0:
	if n % 10 == 0:
		k -= 1
		n /= 10
	else:
		x = min(k, n % 10)
		k -= x
		n -= x
print(int(n))


li = list(map(int, input().split()))
num = li[0]
k = li[1]
while k:
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
	k -= 1
print(num)


args = input()
(number, iterations) = args.split()
number = number
iterations = int(iterations)
year_cnt = 0
for iteration in range(iterations):
	digit = number[-1]
	number = number[:-1]
	if digit == '0':
		continue
	else:
		number += str(int(digit) - 1)
print(number)


def mainFunc():
	(n, k) = [int(i) for i in input().split(' ')]
	while k != 0:
		if n % 10 == 0:
			n = int(n / 10)
		else:
			n -= 1
		k -= 1
	print(n)
mainFunc()


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


(a, b) = map(int, input().split())
for _ in b * [0]:
	a = a % 10 and a - 1 or a // 10
print(a)


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


numbers = input().split()
number = int(numbers[0])
delit = int(numbers[1])
for i in range(delit):
	if number % 10 != 0:
		number -= 1
	elif number % 10 == 0:
		number //= 10
print(number)


(n, k) = map(int, input().split())
f = 0
while f != k:
	if int(str(n)[-1]) == 0:
		n = str(n)
		n = n[:-1]
		n = int(n)
	else:
		n -= 1
	f += 1
print(n)


a = input().split()
c = int(a[0])
d = int(a[1])
for u in range(0, d):
	if c % 10 == 0:
		c = c / 10
	else:
		c = c - 1
print(round(c))


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

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

def li():
	return list(map(int, input().split()))
(n, k) = mi()
for i in range(0, k):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print('{}'.format(n))


X = input().split()
n = int(X[0])
k = int(X[1])

def subtract(a, b):
	x = a % 10
	if x >= b:
		return a - b
	else:
		return subtract((a - x) // 10, b - x - 1)
print(subtract(n, k))


from sys import stdin
(n_str, num_subtractions_str) = stdin.readline().strip().split(' ')
(n, num_subtractions) = (int(n_str), int(num_subtractions_str))
for i in range(num_subtractions):
	if n % 10 != 0:
		n -= 1
	else:
		n //= 10
print(n)


import math
(n, k) = map(int, input().split())
for i in range(0, k):
	last_numeral = math.ceil(10 * (n / 10 - math.trunc(n / 10)))
	if last_numeral == 0:
		n = math.trunc(n / 10)
	else:
		n = n - 1
print(int(n))


args = [int(x) for x in input().split()]
a = list(str(args[0]))
b = int(args[1])
k = 0
while b > 0:
	k = int(a.pop())
	b -= k
	if b <= 0:
		a.append(str(-b))
		break
	else:
		b -= 1
a = ''.join(a)
print(a)


inp = input().split()
for i in range(0, len(inp)):
	inp[i] = int(inp[i])
while inp[1] > 0:
	if inp[0] % 10 == 0:
		inp[0] //= 10
	else:
		inp[0] -= 1
	inp[1] -= 1
print(inp[0])


def fourstep(s, step):
	for x in range(0, step):
		if s % 10 != 0:
			s = s - 1
		else:
			s = s / 10
	return round(s)
(s, step) = [int(x) for x in input().split()]
s_new = fourstep(s, step)
print(s_new)


list1 = []

def wrong_sub(input_list):
	for i in range(input_list[1]):
		if input_list[0] % 10 == 0:
			input_list[0] = input_list[0] // 10
		else:
			input_list[0] -= 1
	return input_list[0]
list1 = list(map(int, input().split(' ')))
print(wrong_sub(list1))


def wrongSub():
	(number, k) = input().split(' ')
	number = int(number)
	k = int(k)
	for i in range(k):
		if str(number)[-1] == '0':
			number //= 10
		else:
			number -= 1
	return number
print(wrongSub())


(n, k) = input().split()
k = int(k)
n = [int(i) for i in n][::-1]
while k:
	if n[0] == 0:
		n.remove(n[0])
	else:
		n[0] -= 1
	k -= 1
print(''.join(map(str, n[::-1])))


def subtraction(n, k):
	m = list(n)
	x = len(m)
	k = int(k)
	for i in range(x):
		m[i] = int(m[i])
	while k != 0:
		if m[x - 1] != 0:
			m[x - 1] -= 1
		else:
			m.pop(x - 1)
			x = len(m)
		k -= 1
	for i in range(x):
		m[i] = str(m[i])
	s = ''
	for num in m:
		s += num
	return s
(n, k) = input().split()
s = subtraction(n, k)
print(s)


import sys

def calc(n, k):
	result = n
	while k > 0:
		if result % 10 == 0:
			result /= 10
		else:
			result -= 1
		k -= 1
	return int(result)
try:
	(n, k) = input().split()
	sum = calc(int(n), int(k))
	print(sum)
except BaseException:
	import sys
	print(sys.exc_info()[0])
	import traceback
	print(traceback.format_exc())


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


(num, sub) = map(int, input().split())
result = num
for _ in range(sub):
	if result % 10 == 0:
		result /= 10
	else:
		result = result - 1
print(int(result))


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, K) = MAP()
N = list(str(N))
for i in range(K):
	if N[-1] == '0':
		N.pop()
	else:
		N[-1] = str(int(N[-1]) - 1)
ans = ''.join(N)
print(ans)


input_string = input()
index_space = input_string.index(' ')
inputinteger = int(input_string[0:index_space])
amount_substractions = int(input_string[index_space + 1:len(input_string)])
count = 1
while count <= amount_substractions:
	if inputinteger % 10 == 0:
		inputinteger //= 10
		count += 1
	else:
		inputinteger -= 1
		count += 1
print(inputinteger)


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


x = input().split()
y = [int(i) for i in x]
for j in range(y[1]):
	a = str(y[0])
	if a[-1] == '0':
		y[0] //= 10
	else:
		y[0] = y[0] - 1
print(y[0])


def op(n):
	for i in range(k):
		if n % 10:
			n -= 1
		else:
			n //= 10
	print(n)
(n, k) = input().split()
(n, k) = (int(n), int(k))
op(n)


class Solution:

	def __init__(self):
		self.n = 0
		self.k = 0

	def read_input(self):
		(self.n, self.k) = map(int, input().split())

	def print_result(self):
		print(self.wrong_subtraction(self.n, self.k))

	def wrong_subtraction(self, n, k):
		for i in range(k):
			last_digit = n % 10
			if last_digit == 0:
				n = n // 10
			else:
				n -= 1
		return n
solution = Solution()
solution.read_input()
solution.print_result()


try:
	(num, n) = map(int, input().split())
	for _ in range(n):
		if num % 10 != 0:
			num = num - 1
		else:
			num /= 10
	print(int(num))
except:
	pass


(num, n) = map(int, input().split(' '))
t = num
for x in range(n):
	if str(t)[-1] == '0':
		t = int(t / 10)
	else:
		t = t - 1
print(t)


counts = input().split()
counts = [int(elem) for elem in counts]
(n, k) = (counts[0], counts[1])
for i in range(k):
	n = int(n)
	if str(n)[-1] != '0':
		n = n - 1
	elif str(n)[-1] == '0':
		n = n / 10
print(int(n))


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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


(num, it) = map(str, input().split())
n = int(num)
p = int(it)
for i in range(p):
	if num[-1] == '0':
		n = n // 10
		num = str(n)
	else:
		n = n - 1
		num = str(n)
print(n)


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


x = input().split()
(a, k) = (x[0], int(x[1]))
while int(a) > 0 and k >= 1:
	if a[-1] == '0':
		a = a[:len(a) - 1]
		k = k - 1
	else:
		a = str(int(a) - 1)
		k = k - 1
print(a)


(n, k) = map(int, input().split())
i = 1
n_out = n
if 2 <= n <= 10 ** 9 and 1 <= k <= 50:
	while k >= i:
		if n_out % 10 == 0:
			n_out = n_out / 10
		elif n_out % 10 != 0:
			n_out = n_out - 1
		i += 1
	if n_out >= 0:
		print(int(n_out))


lst = input()
b = list()
a = list()
a = lst.split()
l = len(a)
for i in range(l):
	k = int(a[i])
	b.append(k)
for i in range(b[1]):
	if b[0] % 10 == 0:
		b[0] = b[0] // 10
	else:
		b[0] = b[0] - 1
print(b[0])


user = input()
ind = user.index(' ')
n = user[:ind]
k = user[ind + 1:]
n = int(n)
k = int(k)
for i in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = int(n / 10)
print(n)


inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
while k > 0:
	lastdigit = n % 10
	if lastdigit != 0:
		if lastdigit >= k:
			n -= k
			k -= lastdigit
		else:
			k -= lastdigit
			n -= lastdigit
	else:
		k -= 1
		n = n // 10
print(n)


def wrong_subtract(number, b):
	while b > 0:
		digit = number % 10
		if digit >= b:
			return number - b
		else:
			number //= 10
			b -= digit + 1
	return number
(a, b) = map(int, input().split())
print(wrong_subtract(a, b))


(s, t) = input().split()
s = int(s)
t = int(t)
for item in range(t):
	if s % 10 == 0:
		s = s // 10
	else:
		s = s - 1
print(s)


def ink(x):
	if str(x)[-1] == '0':
		return int(str(x)[:-1])
	else:
		return x - 1
(n, k) = map(int, input().split())
for i in range(k):
	n = ink(n)
print(n)


(n, k) = input().split()
n = int(n)
k = int(k)

def isZeroEnd(n):
	if 10 * (n // 10) == n:
		return True
for i in range(k):
	if isZeroEnd(n):
		n = n // 10
	else:
		n = n - 1
	i = i + 1
print(n)


import argparse

def wrong_subtraction(n, k):
	output = n
	for i in range(k):
		string_n = str(output)
		if string_n[len(string_n) - 1] == '0':
			output = int(string_n[:-1])
		else:
			output -= 1
	return output
a = list(map(int, input().split()))
n = a[0]
k = a[1]
print(wrong_subtraction(n, k))


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


n = k = 0
x_len = y_len = 0
while int(n) < 2 or int(n) > 1000000000 or int(k) < 1 or (int(k) > 50):
	numbers = input()
	len_numbers = len(numbers) - 1
	first_number = []
	second_number = []
	x = 0
	while numbers[x] != ' ':
		first_number.append(numbers[x])
		if numbers[x] != ' ':
			x += 1
		x_len += 1
	while x <= len_numbers:
		x += 1
		second_number.append(numbers[x])
		y_len += 1
		if x == len_numbers:
			break
	i = j = 0
	while i < x_len:
		n = str(n) + first_number[i]
		i += 1
	while j < y_len:
		k = str(k) + second_number[j]
		j += 1
n = int(n)
k = int(k)
z = 0
while z < k:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	z += 1
print(int(n))


import logging
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)

def solve(n, k):
	for _ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	return n

def main():
	(n, k) = map(int, input().strip().split())
	result = solve(n, k)
	print(result)
main()


(n, k) = list(map(int, input().strip().split(' ')))

def fun(n):
	nn = n % 10
	if nn == 0:
		n = int(n / 10)
	else:
		n = n - 1
	return n
for i in range(k):
	n = fun(n)
print(n)


import sys

def rr():
	return sys.stdin.readline().rstrip()

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import accumulate
from itertools import groupby

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))
MOD17 = 10 ** 9 + 7

def read():
	return rrl()

def solve(n, k):
	for _ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	ans = n
	return ans
test_count = 1
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	print(result)


inn = input().split(' ')
n = int(inn[0])
k = int(inn[1])
t = True
while k != 0:
	res = int(str(n)[-1])
	if res >= k:
		print(n - k)
		t = False
		break
	else:
		k -= res + 1
		n //= 10
if t:
	print(n)


[n, k] = list((int(i) for i in input().split()))
s = str(n)
t = len(s)
for i in range(0, k):
	if s[t - 1] == '0':
		n = n // 10
		s = str(n)
		t = len(s)
	else:
		n = n - 1
		s = str(n)
		t = len(s)
print(n)


(a, b) = map(int, input().split())
for k in range(b):
	c = str(a)
	if c[-1] == '0':
		a = round(a / 10)
	else:
		a = a - 1
print(a)


import math
import os
import random
import re
import sys
total = 0
n = input().rstrip().split()
number = n[0]
sub = n[1]
while sub != 0:
	if int(number) % 10 == 0:
		number = int(number) // 10
	else:
		number = int(number) - 1
	sub = int(sub) - 1
print(number)


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


(n, k) = (int(e.strip()) for e in input().split(' '))
while k > 0:
	if n % 10 != 0:
		n -= 1
	else:
		n /= 10
	k -= 1
print(int(n))


a = list(map(int, input().split()))
ns = str(a[0])
nc = a[0]
k = a[1]
for i in range(k):
	if ns[-1] == '0':
		nc = nc // 10
		ns = str(nc)
	else:
		nc = nc - 1
		ns = str(nc)
print(nc)


(n, k) = [int(x) for x in input().split()]
while k != 0:
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n //= 10
	if n < 0:
		n = 0
		break
	k -= 1
print(n)


(n, k) = input().split()
k = int(k)
l = list(n)
for i in range(k):
	if l[-1] == '0':
		del l[-1]
	else:
		l[-1] = chr(ord(l[-1]) - 1)
print(''.join(l))


import sys
arr = input().split(' ')
(n, k) = (int(arr[0]), int(arr[1]))
for _ in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n -= 1
print(n)


def main():
	(n, m) = map(int, input().split())
	for _ in range(m):
		if n % 10:
			n -= 1
		else:
			n //= 10
	print(n)
main()


def f(n, k):
	while k > 0:
		rem = n % 10
		if rem == 0:
			n = n // 10
			k -= 1
		else:
			sub = min(rem, k)
			n -= sub
			k -= sub
	return n
assert f(512, 4) == 50
assert f(1000000000, 9) == 1
(N, K) = map(int, input().split())
ans = f(N, K)
print(ans)


(n, k) = map(int, input().split())
d = 10
while n != 0 and k != 0:
	temp = n % d
	if temp != 0:
		n = n - min(temp, k)
		k = k - min(temp, k)
	else:
		k -= 1
		n //= 10
print(n)


def ld(n):
	return n % 10
(a, b) = map(int, input().split())
for _ in range(b):
	if ld(a) != 0:
		a -= 1
	else:
		a = a // 10
print(a)


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


import sys
(N, K) = sys.stdin.readline().split(' ')
K = int(K)
i = 0
for d in N[::-1]:
	i -= 1
	d = int(d)
	if K > d + 1:
		K -= d + 1
	else:
		if K != d + 1:
			N = N[:i] + str(d - K)
		else:
			N = N[:i]
		break
print(N)


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


Input = input().split(' ')
num = str(Input[0])
k = int(Input[1])
for i in range(k):
	if num[len(num) - 1] == '0':
		num = str(int(num) // 10)
	else:
		num = str(int(num) - 1)
print(num)


from collections import *
import sys
input = lambda : sys.stdin.readline().strip()
orddict = OrderedDict
defdict = defaultdict
counter = Counter

def nextint():
	return int(input())

def snexts():
	return input().split(' ')

def snextint():
	return map(int, snexts())
(n, k) = snextint()
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n /= 10
		n = int(n)
print(n)


from sys import stdin, stdout
input = stdin.readline

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

def main():
	(k, n) = invr()
	number = int(k)
	count = int(n)
	while count > 0:
		if number % 10 != 0:
			number = number - 1
			count = count - 1
		else:
			number = int(number / 10)
			count -= 1
	print(number)
main()


(Num, value) = [int(i) for i in input().split()]
while value:
	value -= 1
	if Num % 10 == 0:
		Num = Num // 10
	else:
		Num -= 1
print(Num)


def sub(a, b):
	while b != 0:
		if a % 10 != 0:
			a = a - 1
		else:
			a = a // 10
		b = b - 1
	return a
(n, k) = input().split()
print(sub(int(n), int(k)))


import math

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


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


def calc(l, k):
	while k > 0:
		k -= 1
		if l % 10 == 0:
			l = l // 10
		else:
			l -= 1
	print(l)
number = list(map(int, input().split()))
calc(number[0], number[1])


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


zawarudo = input().split()
jotaro = int(zawarudo[0])
dio = int(zawarudo[1])
for i in range(dio):
	if jotaro % 10 == 0:
		jotaro = jotaro // 10
	else:
		jotaro -= 1
print(jotaro)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
(n, k) = sp()
while k:
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
	k -= 1
out(n)


from collections import Counter, defaultdict, deque
import sys, bisect, math, itertools, string, queue
from heapq import heappop, heappush
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7

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

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_str():
	return list(sys.stdin.readline().split())

def inpln(n):
	return list((int(sys.stdin.readline()) for i in range(n)))
(n, k) = inpl()
ll = len(str(n))
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n /= 10
print(int(n))


n_k = [int(i) for i in input().split()]
n = n_k[0]
k = n_k[1]
for j in range(k):
	if n == 0:
		break
	rts = str(n)
	units = rts[-1]
	if units != '0':
		n -= 1
	else:
		n //= 10
print(n)


entrada = input().split()
a = int(entrada[0])
b = int(entrada[1])
cnt = 0
while b > 0:
	if a % 10 != 0:
		a -= 1
	else:
		a = a // 10
	b -= 1
print(a)


from sys import stdin, stdout
from math import factorial as fact
write = stdout.write
(number, n) = map(int, stdin.readline().strip().split())
for i in range(n):
	if str(number)[len(str(number)) - 1] == '0':
		number = number // 10
	else:
		number -= 1
write(str(number))


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().strip().split())
for i in range(k):
	if str(n)[-1] == '0':
		n = int(str(n)[:-1])
	else:
		n -= 1
stdout.write('%d\n' % n)


try:
	(a, b) = list(map(int, input().split()))
	i = 0
	while i < b:
		c = str(a)
		if c[-1] == '0':
			a = a // 10
		else:
			a = a - 1
		i += 1
	print(a)
except:
	pass


arr = [int(i) for i in input().split()][:2]
for i in range(arr[1]):
	if arr[0] % 10 != 0 and arr[0] > 0:
		arr[0] = arr[0] - 1
	else:
		arr[0] = arr[0] / 10
print(int(arr[0]))


(num, counter) = map(int, input().split())
while counter > 0:
	if str(num)[-1] == '0':
		num //= 10
	else:
		num -= 1
	counter -= 1
print(num)


(number, k) = list(map(int, input().split()))

def if_div10(x):
	if x % 10 == 0:
		return True
	return False
for i in range(k):
	if if_div10(number):
		number //= 10
	else:
		number -= 1
print(number)


def main():
	(n, k) = tuple(map(int, input().rstrip().split()))
	for _ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	print(n)
main()


zahl = input()
zahllist = zahl.split()
zahllist2 = list(zahllist[0])
l = len(zahllist[0]) - 1
for i in range(0, int(zahllist[1])):
	if int(zahllist2[l]) != 0:
		zahllist2[l] = int(zahllist2[l])
		zahllist2[l] -= 1
	else:
		zahllist2.pop(l)
		l -= 1
for (a, b) in enumerate(zahllist2):
	zahllist2[a] = str(zahllist2[a])
print(''.join(zahllist2))


def check(s):
	return str(s)[:-1]
(n, k) = map(int, input().split())
while k > 0:
	if str(n)[-1] != '0':
		n = int(n) - 1
	else:
		n = check(n)
	k -= 1
print(n)


def m1(number, k):
	while k > 0:
		last_digit = number % 10
		if last_digit == 0:
			number //= 10
			k -= 1
		elif last_digit <= k:
			number -= last_digit
			k -= last_digit
		else:
			number -= k
			k -= k
	return number
(number, k) = map(int, input().split())
print(m1(number, k))


(n, k) = [int(i) for i in input().split()]
s = [int(i) for i in str(n)]
while k > 0:
	if s[-1] >= k:
		s[-1] -= k
		break
	else:
		k -= s[-1] + 1
		del s[-1]
print(''.join(map(str, s)))


input_list = input().split(' ')
n = int(input_list[0])
k = int(input_list[1])
while k != 0:
	if n > 9:
		if n % 10 == 0:
			n = n / 10
			k = k - 1
		else:
			n = n - 1
			k = k - 1
	else:
		n = n - k
		break
print(int(n))


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


def dg(n):
	res = []
	while n > 0:
		res.append(n % 10)
		n //= 10
	return res

def ddg(m):
	res = 0
	for v in m[::-1]:
		res *= 10
		res += v
	return res
(n, k) = map(int, input().split())
d = dg(n)
while k >= d[0] + 1:
	k -= d[0] + 1
	d.pop(0)
d[0] -= k
print(ddg(d))


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


(n, k) = map(int, input().split())
for x in range(k):
	n = str(n)
	if int(n[-1]) > 0:
		n = int(n) - 1
	else:
		n = n[0:-1]
print(n)


(num, times) = list(map(int, input().split()))
for _ in range(times):
	if str(num)[-1] == '0':
		num //= 10
	else:
		num -= 1
print(num)


import sys

def minus(n: int):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
	return n

def main():
	(n, k) = map(int, input().split())
	for i in range(0, k):
		n = minus(n)
	n = int(n)
	print(n)
main()


entrada = input()
lista = entrada.split(' ')
numero = int(lista[0])
for i in range(int(lista[1])):
	if numero % 10 == 0:
		numero = numero / 10
	else:
		numero = numero - 1
print(int(numero))


def dec(num, i):
	for j in range(i):
		if num % 10 == 0:
			num = num // 10
		else:
			num -= 1
	return num
(num, i) = input().split(' ')
print(dec(int(num), int(i)))


(n, k) = list(map(int, input().split()))

def f(x):
	if x % 10 == 0:
		return x // 10
	else:
		return x - 1
for _ in range(k):
	n = f(n)
print(n)


(n, k) = map(int, input().split())
while n % 10 < k:
	k -= n % 10 + 1
	n = int(n / 10)
print(n - k)


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


import sys
for line in sys.stdin:
	numbers = [int(x) for x in line.strip().split()]
n = numbers[0]
k = numbers[1]
for i in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(a, b) = [int(a) for a in input().split()]
sum1 = 1
while sum1 <= b:
	rem = a % 10
	if rem == 0:
		a //= 10
	else:
		a -= 1
	sum1 += 1
print(a)


x = input().split()
nk = []
for i in x:
	nk.append(int(i))
n = nk[0]
k = nk[1]
while k > 0:
	if n % 10 == 0:
		n /= 10
		k -= 1
	elif n % 10 != 0:
		n -= 1
		k -= 1
print(int(n))


inp = list(map(int, input().split()))
count = 0
for _ in range(inp[1]):
	if str(inp[0])[-1] == '0':
		inp[0] = inp[0] // 10
	else:
		inp[0] = inp[0] - 1
print(inp[0])


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


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for __ in range(t):
	(n, k) = map(int, input().split())
	while k:
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
		k -= 1
	print(n)


import sys
data = sys.stdin.readlines()
lis = []
for line in data:
	lis.append(line)
(n, k) = lis[0].split()
k = int(k)
for i in range(k):
	if n[-1] == '0':
		n = n[:-1]
	else:
		n = str(int(n) - 1)
print(n)


def sub(n, k):
	for i in range(k, 0, -1):
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
	return int(n)
import sys
(n, k) = sys.stdin.readlines()[0].split(' ')
print(sub(int(n), int(k)))


input_ = input()
number = int(input_.split()[0])
pases = int(input_.split()[1])
for i in range(pases):
	if str(number)[-1] == '0':
		number = int(number / 10)
	else:
		number -= 1
print(number)


number1 = input()
number1_split = list(map(int, number1.split()))
number2 = number1_split[1]
number_1 = number1_split[0]
for num in range(number2):
	if number_1 % 10 != 0:
		number_1 = number_1 - 1
	else:
		number_1 = number_1 // 10
print(number_1)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
for _ in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
stdout.write('%d\n' % n)


(n, k) = [int(x) for x in input().split(' ')]

def f(n, k):
	if k == 0:
		return n
	if n % 10 != 0:
		return f(n - 1, k - 1)
	return f(n // 10, k - 1)
print(f(n, k))


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


(r, t) = input().split(' ')
for i in range(0, int(t)):
	if r[len(r) - 1] == '0':
		r = r[0:len(r) - 1]
	else:
		r = str(int(r) - 1)
print(int(r))


a = str(input())
b = [int(x) for x in a.split(' ')]
n = b[0]
k = b[1]
cnt = 0
while cnt != k:
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	cnt = cnt + 1
print(n)


def wrongSubtraction(number, k):
	localNumb = number
	for i in range(k):
		if localNumb % 10 == 0 and len(str(localNumb)) > 1:
			localNumb = int(localNumb / 10)
		else:
			localNumb = localNumb - 1
	print(localNumb)
inputGiven = input().split()
wrongSubtraction(int(inputGiven[0]), int(inputGiven[1]))


a = input().split()

def Subtraction(i, j):
	for x in range(j):
		if i % 10 == 0:
			i = i / 10
		else:
			i = i - 1
	print(int(i))
Subtraction(int(a[0]), int(a[1]))


data = list(map(int, input().split()))
n = data[0]
k = data[1]

class Solution:

	def wrong_subtraction(self, number: int, k: int):
		for i in range(0, k):
			if number % 10 == 0:
				number //= 10
			else:
				number -= 1
		return number
sol = Solution()
print(sol.wrong_subtraction(n, k))


a = input()
a = [int(s) for s in a.split()]
while a[1] != 0:
	if a[0] % 10 != 0:
		a[0] = a[0] - 1
	else:
		a[0] = a[0] / 10
	a[1] = a[1] - 1
print(int(a[0]))


(a, b) = input().split()
b = int(b)
n = len(a)
while b:
	b -= 1
	if a[-1] != '0':
		a = a[:n - 1] + str(int(a[-1]) - 1)
	else:
		a = a[:n - 1]
		n -= 1
	if a == '':
		a = '0'
		break
print(a)


line = input().split()
n = int(line[0])
k = int(line[1])
while k > 0:
	if n % 10 + 1 > k:
		n -= k
		break
	else:
		k -= n % 10 + 1
		n //= 10
print(n)


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


data = input().split()
number = int(data[0])
operations = int(data[1])
for _ in range(operations):
	if number % 10 == 0:
		number //= 10
	else:
		number -= 1
print(number)


import math
(n, k) = list(map(int, input().split(' ')))
for x in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n //= 10
print(n)


def int_array():
	return list(map(int, input().split()))
a = int_array()
no = a[0]
times = a[1]
for i in range(times):
	if str(no)[-1:] == '0':
		no = int(no / 10)
	else:
		no = int(no - 1)
print(no)


(n, k) = input().split()
n = list(map(int, n))
for i in range(int(k)):
	if n[-1] == 0:
		n.pop()
	else:
		n[-1] -= 1
print(*n, sep='')


numeri = input().split(' ')
for volte in range(int(numeri[1])):
	if int(numeri[0]) % 10 == 0:
		numeri[0] = int(numeri[0]) / 10
	else:
		numeri[0] = int(numeri[0]) - 1
print(int(numeri[0]))


def solve():
	(N, K) = map(int, input().split())
	while K > 0:
		if N % 10 == 0:
			N //= 10
		else:
			N -= 1
		K -= 1
	print(N)
Testcase = 1
for _ in range(Testcase):
	solve()


n = input().split()
j = 0
for i in range(len(n)):
	n[i] = int(n[i])
while j < n[1]:
	if n[0] % 10 != 0:
		n[0] -= 1
	else:
		n[0] /= 10
	j += 1
print(int(n[0]))


numb = input().split()
rounds = int(numb[1])
for i in range(rounds):
	if int(numb[0][-1]):
		var = int(numb[0]) - 1
		numb[0] = str(var)
	else:
		numb[0] = str(int(int(numb[0]) / 10))
print(numb[0])


(n, t) = [int(x) for x in input().split()]
s = str(n)
while t:
	t = t - 1
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


inputArray = input().split(' ')
actualNumber = int(inputArray[0])
n = int(inputArray[1])
for items in range(n):
	if actualNumber % 10 == 0:
		actualNumber = actualNumber / 10
	else:
		actualNumber = actualNumber - 1
print(round(actualNumber))


texto = input()
lista = texto.split(' ')
n = int(lista[0])
k = int(lista[1])
res = n
for i in range(k):
	if str(res)[-1] == '0':
		res //= 10
	else:
		res -= 1
print(res)


import sys
sys.setrecursionlimit(10 ** 6)
debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == '-d' else False
if debug_mode:
	import os
	inf = open(os.path.basename(__file__).replace('.py', '.in'))

	def input():
		return inf.readline()

def main():
	(n, k) = list(map(int, input().strip().split()))
	while k > 0:
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
		k -= 1
	print(int(n))
main()
if debug_mode:
	inf.close()


(n, k) = [int(x) for x in input().split()]
while k > 0:
	z = str(n)
	z = list(z)
	if z[-1] == '0':
		n = int(n / 10)
		k -= 1
	else:
		n -= 1
		k -= 1
print(n)


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


import sys
from sys import stdin, stdout
(n, k) = [int(x) for x in stdin.readline().rstrip().split()]

def solution(n, k):
	for i in range(k):
		reminder = n % 10
		if reminder != 0:
			n -= 1
		else:
			n /= 10
	return round(n)
print(solution(n, k))


a = str(input()).split()
k = int(a[1])
a = a[0]
b = int(a)
for _ in range(k):
	if a[len(a) - 1] != '0':
		b -= 1
		a = str(b)
	else:
		b = b // 10
		a = str(b)
print(a)


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


(n, m) = map(int, input().split())
tt = len(str(n))
while m >= 1:
	temp = list(str(n))
	if int(temp[-1]) > 0:
		n -= 1
	if int(temp[-1]) == 0:
		n /= 10
		n = int(n)
	m -= 1
print(n)


import math
nums = input()
nums = nums.split()
for i in range(len(nums)):
	nums[i] = int(nums[i])
for i in range(nums[1]):
	if nums[0] % 10 == 0:
		nums[0] = math.floor(nums[0] / 10)
	else:
		nums[0] -= 1
print(nums[0])


(number, subtract) = input().split()
int_num = int(number)
int_sub = int(subtract)
for i in range(int_sub):
	if number[len(number) - 1] == '0':
		int_num = int_num // 10
		number = str(int_num)
	else:
		int_num -= 1
		number = str(int_num)
print(int(number))


arr = input()
arr1 = arr.split()
nums = int(arr1[0])
times = int(arr1[1])
for i in range(times):
	if nums % 10 == 0:
		nums /= 10
	else:
		nums -= 1
print(int(nums))


entrada = input()
entrada = entrada.split()
output = int(entrada[0])
times = int(entrada[1])

def check_last_digit(x):
	x = str(x)
	evaluador = int(x[-1])
	if evaluador != 0:
		x = int(x)
		x = x - 1
	elif evaluador == 0:
		x = int(x)
		x = x / 10
	x = int(x)
	return x
for i in range(times):
	output = check_last_digit(output)
print(output)


(n, j) = map(int, input().split())
for i in range(j):
	last = n % 10
	if last != 0:
		n -= 1
	else:
		n /= 10
print(int(n))


inp = input()
inp = inp.split(' ')
n = int(inp[0])
k = int(inp[1])

def answer(num, sub):
	for i in range(sub):
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
	return int(num)
print(answer(n, k))


s = input()
(number, k) = list(s.split(' '))
number = str(number)
k = int(k)
for i in range(k):
	if number[len(number) - 1] != '0':
		number = str(int(number) - 1)
	elif number[int(len(number)) - 1] == '0':
		number = number[:len(number) - 1]
print(number)


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0:
			return 0
	return 1
(n, k) = map(int, z().split())
for _ in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print(max(0, n))


import math
import os
import random
import re
import sys
(ix, iy) = input().split(' ')

def wsubtraction(a, b):
	x = int(a)
	y = int(b)
	t = 0
	while t < y:
		if x % 10 == 0:
			x = x / 10
		else:
			x -= 1
		t += 1
	print(int(x))
wsubtraction(ix, iy)


from collections import deque
n_k = [int(i) for i in input().split()]
n = n_k[0]
k = n_k[1]
d = deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
for j in range(k):
	if n == 0:
		break
	rts = str(n)
	units = rts[-1]
	if units == '0':
		n = int(rts[:-1])
	else:
		pos = d.index(int(units))
		d.rotate(1)
		n = int(rts[:-1] + str(d[pos]))
print(n)


def mo(num):
	if not str(num).endswith('0'):
		return num - 1
	else:
		return int(num / 10)
a = input().split()
n = int(a[0])
k = int(a[1])
res = n
for i in range(k):
	res = mo(res)
print(res)


(number, k) = list(map(int, input().split()))
i = 0
lastDigit = number % 10
while i < k:
	if lastDigit == 0:
		number = number / 10
		lastDigit = number % 10
	else:
		number = number - 1
		lastDigit = number % 10
	i += 1
print(round(number))


number = list(map(int, input().split()))
n1 = str(number[0])
n2 = number[1]
i = 0
while i < n2:
	if n1[-1] == '0':
		n1 = int(n1)
		n1 = n1 // 10
		n1 = str(n1)
	else:
		n1 = int(n1)
		n1 -= 1
		n1 = str(n1)
	i += 1
print(int(n1))


inp = input
iinp = lambda : int(inp())
(n, k) = map(int, inp().split(' '))
for _ in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n = n // 10
print(n)


(n, k) = input().split()
n1 = int(n)
k1 = int(k)
for _ in range(k1):
	if n1 % 10 == 0:
		n1 = n1 // 10
	else:
		n1 = n1 - 1
print(n1)


ord: str = input()
(num, dec) = ord.split(' ')
dec = int(dec)
num = int(num)
while dec > 0:
	if str(num)[-1] == '0':
		num = int(num / 10)
	else:
		num = num - 1
	dec = dec - 1
print(num)


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


(n, k) = map(str, input().split())
indice = len(n) - 1
aux = 0
while int(k) > 0:
	if n[indice] == '0':
		n = str(int(int(n) / 10))
		k = str(int(k) - 1)
		indice -= 1
	else:
		aux = int(n) - 1
		n = str(aux)
		k = str(int(k) - 1)
print(n)


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


string = str(input()).split(' ')
number = string[0]
loop_num = int(string[1])
while loop_num > 0:
	if number[len(number) - 1] == '0':
		number_int = int(number) // 10
		number = str(number_int)
		loop_num -= 1
	else:
		number_int = int(number) - 1
		number = str(number_int)
		loop_num -= 1
print(number)


inp = [int(x) for x in input().split()]
n = inp[0]
k = inp[1]
while k > 0:
	last_digit = int(str(n)[-1])
	if last_digit > 0:
		n -= 1
	elif last_digit == 0:
		n = n // 10
	k -= 1
print(n)


def sub(n, k):
	for i in range(0, k):
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
	return n
try:
	xy = input().split()
	x = xy[0]
	y = xy[1]
	a = sub(int(x), int(y))
	print(a)
except:
	pass


first = input()
first_split = first.rsplit(' ')
n = int(first_split[0])
k = int(first_split[1])
while k > 0:
	if n % 10 == 0:
		n = n / 10
		k -= 1
	else:
		n -= 1
		k -= 1
print(int(n))


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


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


numbers = input()
n = numbers[:numbers.index(' ')]
k = numbers[numbers.index(' ') + 1:]
n = int(n)
k = int(k)
while k > 0:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	k -= 1
print(int(n))


(n, k) = input().split()

def f(n, k):
	n = [int(i) for i in list(str(n))]
	while k != 0:
		if n[-1] == 0:
			n.pop()
			k -= 1
		else:
			n[-1] = n[-1] - 1
			k -= 1
	return ''.join([str(i) for i in n])
print(f(n, int(k)))


(num, k) = map(int, input().strip().split(' '))
for i in range(0, k):
	if num % 10 is not 0:
		num -= 1
	else:
		num //= 10
print(num)


def main():
	(n, k) = liee()
	for i in range(k):
		if n % 10:
			n -= 1
		else:
			n //= 10
	print(n)

def fun(m, n, s, k):
	return

def fun2(s):
	return
from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 5

def lie():
	return int(input())

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

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

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
dmain()


(n, k) = [int(x) for x in input().split()]
if k < 0 and k > 50:
	raise ValueError('1<=k<=50')
if n < 2 and n > pow(10, 9):
	raise ValueError('2<=n<=10e9')
for i in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


from typing import List
inputValues: List[int] = list(map(int, input().split()))
n: int = inputValues[0]
k: int = inputValues[1]
for val in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


nos = [int(x) for x in str(input()).split(' ')]
no = nos[0]
times = nos[1]
for i in range(times):
	if str(no)[-1] != '0':
		no -= 1
	else:
		no //= 10
print(no)


lista = input().split()
broj = int(lista[0])
broj_oduzimanja = int(lista[1])
final_broj = 0
for i in range(broj_oduzimanja):
	if broj % 10 == 0:
		broj //= 10
	else:
		broj -= 1
print(broj)


a = input().split(' ')
l = []
for i in a:
	l.append(int(i))
for i in range(l[1]):
	if l[0] - l[0] // 10 * 10 != 0:
		l[0] = l[0] - 1
	else:
		l[0] = l[0] / 10
print(int(l[0]))


def incmin(a, k):
	for el in range(k):
		if a % 10 == 0:
			a = a // 10
		else:
			a -= 1
	print(a)
(a, k) = input().split(' ')
a = int(a)
k = int(k)
incmin(a, k)


inp = input()
num = int(inp.split(' ')[0])
k = int(inp.split(' ')[1])
i = 0
while i < k:
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
	i += 1
print(num)


(num, t) = map(int, input().split())
i = 0
while i < t:
	s = list(str(num))
	if s[-1] != '0':
		num = num - 1
	else:
		num = num // 10
	i = i + 1
print(num)


def main():
	(n, k) = list(map(int, input().split()))
	for x in range(k):
		if str(n)[-1] == '0':
			n = int(n / 10)
		else:
			n -= 1
	print(n)
main()


(x, y) = input().split()
for i in range(int(y)):
	if int(x) > 0:
		if x[-1] != '0':
			x = int(x) - 1
			x = str(x)
		elif x[-1] == '0':
			x = int(x) // 10
			x = str(x)
	else:
		break
print(x)


def is_nonzero(n):
	return int(n - 1)

def is_zero(n):
	return int(n / 10)
nAndk = list(map(int, input().split()))
n = str(nAndk[0])
k = nAndk[1]
for i in range(k):
	if int(n[-1]) != 0:
		n = is_nonzero(int(n))
		n = str(n)
	else:
		n = is_zero(int(n))
		n = str(n)
else:
	print(int(n))


(n, a) = list(map(int, input().split()))
m = list(str(n))
for i in range(a):
	if m[len(m) - 1] == '0':
		m.remove(m[len(m) - 1])
	else:
		t = int(m[len(m) - 1]) - 1
		m[len(m) - 1] = str(t)
print(''.join(m))


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


(n, k) = map(int, input().split())
d = []
a = str(n)
for i in range(len(a)):
	d.append(a[i])
d.reverse()
x = 0
while k != 0:
	if d[x] != '0':
		d[x] = int(d[x])
		d[x] -= 1
		d[x] = str(d[x])
	else:
		d.pop(0)
	k -= 1
d.reverse()
answer = ''
for i in range(len(d)):
	answer += d[i]
print(int(answer))


def wrong_subtraction(n, k):
	for __ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	return n

def main():
	input_string = input()
	input_split = input_string.split()
	input_ints = [int(arg) for arg in input_split]
	(n, k) = input_ints
	result = wrong_subtraction(n, k)
	print(result)
main()


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


ipt = input().split(' ')
num = int(ipt[0])
times = int(ipt[1])
current = 0
while True:
	if current == times:
		break
	current += 1
	if str(num)[len(str(num)) - 1] != '0':
		num = num - 1
	else:
		num = num // 10
print(num)


try:
	(a, b) = input().split(' ')
	a_int = int(a)
	b_int = int(b)
	if a_int >= 2 and a_int <= 10 ** 9 and (b_int >= 1) and (b_int <= 50):
		i = 0
		while i < b_int:
			if a_int % 10 == 0:
				a_int = a_int // 10
			else:
				a_int -= 1
			i += 1
		print(a_int)
except Exception as e:
	print(e)


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


from math import *
(n, a) = map(int, input().split())
v = 0
g = 0
for i in range(a):
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n = n // 10
print(n)


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


def tanya(x, i):
	for c in range(i):
		if x % 10 == 0:
			x /= 10
		else:
			x -= 1
	print(int(x))
(num, repeat) = input().split()
num = int(num)
repeat = int(repeat)
tanya(num, repeat)


def subtract(num, k):
	for i in range(k):
		if num % 10 != 0:
			num -= 1
		else:
			num = num // 10
	return num
(num, k) = map(int, input().split())
print(subtract(num, k))


num = input()
arr = []
count = 0
for i in range(0, len(num)):
	if num[i] == ' ':
		arr.append(int(num[count:i]))
		count = i + 1
	elif i == len(num) - 1:
		arr.append(int(num[count:len(num)]))
i = 0
while i < arr[1]:
	if arr[0] % 10 == 0:
		arr[0] = arr[0] / 10
	else:
		arr[0] -= 1
	i += 1
print(int(arr[0]))


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


(n, d) = map(int, input().split())
for i in range(d):
	if n % 10 == 0:
		n //= 10
	elif n % 10 != 10:
		n -= 1
print(n)


import sys
for line in sys.stdin:
	paras = str(line).split()
	w = int(paras[0])
	k = int(paras[1])
	while k > 0:
		if w % 10 == 0:
			w = w / 10
		else:
			w -= 1
		k -= 1
	print(int(w))


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


(n, k) = input().split()
n = int(n)
k = int(k)
d = 0
temp = n
while temp > 0:
	temp = int(temp / 10)
	d += 1
for i in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = int(n / 10)
print(n)


(n, k) = map(int, input().split())
n = str(n)
l = []
for i in n:
	l.append(int(i))
for _ in range(k):
	if l[-1] != 0:
		l[-1] = l[-1] - 1
	else:
		del l[-1]
print(''.join((str(x) for x in l)))


(n, k) = map(str, input().split())
t = int(k)
for i in range(len(n)):
	if t > int(n[-1]):
		t -= int(n[-1]) + 1
		n = n[:-1]
print(int(n) - t)


import re
s = input()
d = re.findall('\\d+', s)
a = int(d[0])
b = int(d[1])
nstep = 1
if b == 0:
	print(a)
else:
	while nstep <= b:
		if a % 10 == 0:
			a = a // 10
			nstep = nstep + 1
		else:
			a = a - 1
			nstep = nstep + 1
print(a)


import sys
import math
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
(n, k) = map(int, sys.stdin.readline().split(' '))
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n = n // 10
print(n)


(inp, t) = input().split()
for i in range(int(t)):
	inp = f'{inp[:-1]}{int(inp[-1]) - 1}' if inp[-1] != '0' else inp[:-1]
print(inp)


nums = input().split(' ')
num = int(nums[0])
k = int(nums[-1])

def solve(k, num):
	for i in range(k):
		if num % 10 == 0:
			num = int(num / 10)
		else:
			num -= 1
	return num
print(solve(k, num))


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


(r, t) = map(int, input().strip().split())
for _ in range(t):
	if r % 10 == 0:
		r /= 10
	else:
		r -= 1
print(int(r))


import math
(n, k) = map(int, input().split())
while k > 0:
	l = math.fmod(n, 10)
	if l == 0:
		n = n / 10
	elif l != 0:
		n = n - 1
	k -= 1
print(int(n))


(num, n) = list((int(x) for x in input().strip().split()))[:2]
while n != 0:
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
	n -= 1
print(num)


(a, b) = map(int, input().split())

def kam(a, b):
	if b == 0:
		return a
	elif a % 10 == 0:
		return kam(int(a / 10), b - 1)
	else:
		return kam(a - 1, b - 1)
print(kam(a, b))


(n, k) = map(eval, input().split())
for a in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = n / 10
print(int(n))


(m, k) = map(int, input().split(' '))
res = []
i = 0
while i < k:
	res = [int(x) for x in str(m)]
	if res[-1] == 0:
		m = int(m / 10)
	else:
		m -= 1
	res = []
	i += 1
print(m)


(n, k) = input().split()
k = int(k)
for i in range(k):
	last = int(n[len(n) - 1])
	n = n[:-1]
	if last == 0:
		n = n
	else:
		p = last - 1
		n = n + str(p)
print(n)


def weird_subtract(n):
	last_dig = n % 10
	if last_dig == 0:
		return int(n / 10)
	else:
		return n - 1

def main():
	numbers = input().split(' ')
	n = int(numbers[0])
	k = int(numbers[1])
	curr = n
	for i in range(k):
		curr = weird_subtract(curr)
	print(curr)
main()


def Subtraction(num, c):
	if c == 0:
		return num
	else:
		c -= 1
		if int(str(num)[-1]) != 0:
			num -= 1
		else:
			num /= 10
		return Subtraction(int(num), c)
INPUT_VALUE = str(input()).split(' ')
print(Subtraction(int(INPUT_VALUE[0]), int(INPUT_VALUE[1])))


import sys
from random import choice, randint
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, sys.stdin.readline().strip().split())

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().strip().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def LS():
	return sys.stdin.readline().strip().split()

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

def F():
	return float(sys.stdin.readline().strip())

def S():
	return sys.stdin.readline().strip()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	(n, k) = MI()
	i = 0
	while i < k:
		if str(n)[-1] != '0':
			n -= 1
		else:
			n = n // 10
		i += 1
	pf(n)
main()


import math
import re
(a, b) = map(int, input().split())
for i in range(b):
	if a % 10 == 0:
		a /= 10
	else:
		a -= 1
print(int(a))


a = input().split()
b = int(a[1])
aa = str(a[0])
while b > 0:
	if aa[-1] == '0':
		aa = aa[:-1]
	else:
		c = int(''.join(aa))
		c -= 1
		aa = str(c)
	b -= 1
print(aa)


(number, howmuch) = [int(a) for a in input().split()]
for a in range(howmuch):
	if str(number)[-1] == '0':
		number = number // 10
	else:
		number -= 1
print(number)


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


(number, count) = map(lambda x: int(x), input().split(' '))
for i in range(count):
	if number % 10 == 0:
		number = int(number / 10)
	else:
		number -= 1
print(number)


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


a = input().split()
b = []
for i in a[0]:
	b.append(int(i))
for j in range(int(a[1])):
	if b[-1] != 0:
		b[-1] -= 1
	else:
		b.remove(b[-1])
for j in b:
	print(j, end='')


(x, y) = list(map(int, input().split()))
x = float(x)
y = int(y)
while y:
	l = x / 10
	if int(l) - float(l) == 0:
		x = int(x / 10)
	else:
		x -= 1
	y -= 1
print(int(x))


(n, k) = map(int, input().split())
n = str(n)
if int(n) >= 2 and int(n) <= 10 ** 9 and (k >= 1) and (k <= 50):
	for i in range(k):
		if n[-1] != '0':
			sum = int(n) - 1
			n = str(sum)
		elif n[-1] == '0':
			sum = n[0:-1]
			n = sum
	print(sum)
else:
	quit()


(n, k) = map(int, input().split())
p = 0
while k != 0:
	h = n % 10
	if h + 1 < k:
		n = n // 10
		k = k - h - 1
	elif h + 1 == k:
		n = n // 10
		k = 0
	else:
		n = n - k
		k = 0
print(n)


getInput = input()
(number, num) = getInput.split()
number = int(number)
num = int(num)
for i in range(num):
	if number % 10 != 0:
		number = number - 1
	else:
		number = number / 10
print(int(number))


myInput = [int(x) for x in input().split(' ')]
value = myInput[0]
diff = myInput[1]
del myInput
result = 0
while diff != 0:
	if value % 10 == 0:
		result = value // 10
		value = value // 10
	else:
		result = value - 1
		value = value - 1
	diff -= 1
print(result)


(num, k) = input().split()
c = 0
k = int(k)
for i in range(len(num)):
	c += int(num[-(i + 1)])
	if c >= k:
		c -= k
		break
	k -= 1
else:
	c -= k
print(num[0:-(i + 1)] + str(c))


(n, k) = [int(i) for i in input().split()]
i = 0
while i < k:
	if n % 10 != 0:
		n -= 1
	elif n % 10 == 0:
		n /= 10
	i += 1
print(str(int(n)))


def change():
	global n
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
(n, k) = (int(e) for e in input().split(' '))
for i in range(0, k):
	change()
print(int(n))


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


(a, b) = [int(i) for i in input().split()]
k = 0
c = str(a)
while k < b:
	if c[len(c) - 1] != '0':
		c = str(int(c) - 1)
		k = k + 1
	else:
		c = str(c[0:len(c) - 1])
		k = k + 1
	if k == b:
		break
print(c)


(a, b) = map(int, input().split())
c = 0
d = a
while True:
	if a % 10 == 0:
		d = a // 10
		a = a // 10
		c += 1
		if c == b:
			print(d)
			break
	else:
		d -= 1
		a -= 1
		c += 1
		if c == b:
			print(d)
			break


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


nek = input().split(' ')
n = nek[0]
87
k = int(nek[1])
ris = int(n)
i = 0
while i < k:
	if ris % 10 == 0:
		ris = ris // 10
	else:
		ris = ris - 1
	i += 1
print(ris)


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


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1
x = read_array()
k = x[1]
n = x[0]
for i in range(k):
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


nums = input().split()
for i in range(len(nums)):
	nums[i] = int(nums[i])
number = nums[0]
subtractions = nums[1]
for i in range(subtractions):
	if str(number)[-1] == '0':
		number = number // 10
	else:
		number -= 1
print(number)


enter_string = input()
array = enter_string.split(' ')
number = int(array[0])
for i in range(int(array[1])):
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
print(int(number))


inp = list(map(int, input().split()))
num = inp[0]
counter = inp[1]
while counter:
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
	counter -= 1
print(int(num))


(x, y) = input().split()
y = int(y)
x = list(x)
while y > 0:
	for i in x:
		if x[-1] == '0':
			x.pop(-1)
			y -= 1
			break
		else:
			x[-1] = int(x[-1]) - 1
			y -= 1
			x[-1] = str(x[-1])
			break
x[-1] = str(x[-1])
print(''.join(x))


ainput = input().split()
temp = int(ainput[0])
for a in range(int(ainput[1])):
	if temp % 10 == 0:
		temp /= 10
	else:
		temp -= 1
print(int(temp))


import sys
input = sys.stdin.readline
(num, times) = map(int, input().split())
for i in range(times):
	if num % 10 != 0:
		num -= 1
	else:
		num /= 10
print(int(num))


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


class Solution:

	def solve(self, n, k):
		inp = list(str(n))
		for _ in range(k):
			if inp[-1] == '0':
				inp.pop()
			else:
				inp[-1] = str(int(inp[-1]) - 1)
		return ''.join(inp)
sol = Solution()
[n, k] = list(map(int, input().strip().split()))
print(sol.solve(n, k))


x = [int(y) for y in input().split()]
while True:
	if x[1] <= 0:
		break
	s = str(x[0])
	if s[-1] == '0':
		x[0] = x[0] // 10
	else:
		x[0] = x[0] - 1
	x[1] -= 1
print(x[0])


from decimal import Decimal
(t, k) = map(int, input().split())
for _ in range(k):
	if t % 10 != 0:
		t -= 1
	else:
		t = Decimal(t) / Decimal(10)
print(t)


from math import *
(x, y) = input().split()
x = int(x)
y = int(y)
for i in range(y):
	if x % 10 == 0:
		x = x / 10
	else:
		x = x - 1
print(int(x))


y = input().split()
x = int(y[0])
y = int(y[1])

def xxx():
	global x
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
for i in range(y):
	xxx()
print(int(x))


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


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


(n, k) = input().split()
k = int(k)
l = []
for i in range(len(n)):
	l.append(int(n[i]))
while k > 0 and l[0] > 0:
	if l[-1] == 0:
		l.remove(l[-1])
		k -= 1
		continue
	l[-1] -= 1
	k -= 1
for i in range(len(l)):
	print(l[i], end='')


def wrong_sub(number, sub):
	for _ in range(0, sub):
		if number % 10 == 0:
			number = int(number / 10)
		else:
			number = number - 1
	return number
(a, b) = map(int, input().split(' '))
print(wrong_sub(a, b))


raw_input = input()
(divisor_num, times) = raw_input.split()
divisor_num = int(divisor_num)
times = int(times)
for x in range(0, times):
	if divisor_num % 10 != 0:
		divisor_num -= 1
	else:
		divisor_num = int(divisor_num / 10)
print(divisor_num)


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


z = input
import math
(a, b) = list(map(int, z().split()))
s = 0
for i in range(b):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


def bad_subtract(n, k):
	print(__bad_subtract_helper__(n, k))

def __bad_subtract_helper__(n, k):
	if k == 0:
		return n
	elif n % 10 == 0:
		return __bad_subtract_helper__(n // 10, k - 1)
	else:
		return __bad_subtract_helper__(n - 1, k - 1)

def test_alg():
	test_cases = [(512, 4)]
	for case in test_cases:
		(n, k) = case
		bad_subtract(n, k)
input_line = input()
input_values = input_line.split(' ')
n = int(input_values[0])
k = int(input_values[1])
bad_subtract(n, k)


p = list(map(int, input().split()))
a = p[0]
k = p[1]
while k > 0:
	c = a % 10
	if c == 0:
		a = a / 10
		k = k - 1
	else:
		a = a - 1
		k = k - 1
print(int(a))


def convertir(n):
	if n[-1] == '0':
		return n[0:len(n) - 1]
	else:
		return n[0:len(n) - 1] + str(int(n[-1]) - 1)
(n, k) = [int(x) for x in input().split()]
n = str(n)
for i in range(k):
	n = convertir(n)
print(n)


import time
import collections

class Time_test:

	def __enter__(self):
		self.enter_time = time.time()

	def __exit__(self, exc_type, exc_val, exc_tb):
		print('Command was executed in', time.time() - self.enter_time)
(n, k) = [int(x) for x in input().split()]
for i in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


n = input()
(num, ones) = n.split(' ')
i = int(ones)
while i > 0:
	num = str(num)
	if num[-1] == '0':
		num = num[:-1]
	else:
		num = int(num)
		num -= 1
	i -= 1
print(num)


(n, m) = map(int, input().split())
l = list(str(n))
for i in range(0, m):
	if l[len(l) - 1] == '0' or l[len(l) - 1] == 0:
		x = l.pop()
	else:
		l[len(l) - 1] = int(l[len(l) - 1]) - 1
num = 0
for i in range(0, len(l)):
	num = num * 10 + int(l[i])
print(num)


n = input()
lst = n.split()
v = int(lst[0])
t = int(lst[1])
for i in range(t):
	last = v % 10
	if last != 0:
		v = v - 1
	else:
		v = v // 10
print(v)


def t_sub(num):
	if not num % 10:
		return num // 10
	else:
		return num - 1

class CodeforcesTask977ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]

	def process_task(self):
		for x in range(self.n_k[1]):
			self.n_k[0] = t_sub(self.n_k[0])
		self.result = str(self.n_k[0])

	def get_result(self):
		return self.result
Solution = CodeforcesTask977ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


def wrongsub(x):
	if x % 10 == 0:
		return x // 10
	else:
		return x - 1
(n, k) = map(int, input().split())
if k == 0:
	print(n)
else:
	c = k
	ans = wrongsub(n)
	while c > 1:
		c -= 1
		ans = wrongsub(ans)
		if c == 1:
			break
	print(ans)


(x, y) = list(map(int, input().split()[:2]))
for i in [1] * y:
	if x % 10 == 0:
		x = x / 10
	else:
		x -= i
print(int(x))


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


def get_input():
	input_str = input()
	(number, sub_count) = input_str.split()
	return (int(number), int(sub_count))

def show_result(number):
	print(number)

def process(number: int, sub_count: int) -> int:
	result = number
	for _ in range(sub_count):
		if not result % 10:
			result = result // 10
		else:
			result -= 1
	return result
(number, sub_count) = get_input()
r = process(number, sub_count)
show_result(r)


x = input()
nums = [int(n) for n in x.split()]
y = 0
while y < nums[1]:
	if nums[0] % 10 != 0:
		nums[0] = nums[0] - 1
		y += 1
	elif nums[0] % 10 == 0:
		nums[0] = nums[0] / 10
		y += 1
	else:
		continue
print(int(nums[0]))


(number, times) = input().split(' ')
number = eval(number)
times = eval(times)
for element in range(0, times):
	if number % 10 == 0:
		number = number / 10
	else:
		number = number - 1
print(int(number))


(num, times) = input().split()
num = int(num)
times = int(times)
for count in range(times):
	if num % 10 != 0:
		num = num - 1
	else:
		num = num / 10
print(int(num))


request = input('')
request_1 = request.split()
(num, num_of_sub) = request_1
num = int(num)
num_of_sub = int(num_of_sub)
for _ in range(num_of_sub):
	if num != 0:
		if num % 10 == 0:
			num = num / 10
		else:
			num = num - 1
			if num == 0:
				num = 1
				break
	else:
		num = 1
		break
print(int(num))


line = input().strip().split()
num1 = int(line[0])
num2 = int(line[1])
while num2 > 0:
	num2 -= 1
	if str(num1)[-1] == '0':
		num1 /= 10
		num1 = int(num1)
	else:
		num1 -= 1
print(num1)


n = input().split(' ')
n[0] = int(n[0])
n[1] = int(n[1])
while n[1] > 0:
	if n[0] % 10 != 0:
		if n[0] % 10 >= n[1]:
			n[0] -= n[1]
			print(n[0])
			break
		else:
			n[1] -= n[0] % 10
			n[0] -= n[0] % 10
			if n[1] == 0:
				Print(n[0])
				break
	else:
		n_str = str(n[0])
		n_str = n_str[:len(n_str) - 1]
		n[0] = int(n_str)
		n[1] -= 1
		if n[1] == 0:
			print(n[0])
			break


string = input()
stri = string.split()
for i in range(2):
	stri[i] = int(stri[i])
	i += 1
n = stri[0]
k = stri[1]

def sub(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
		i += 1
	return n
print(int(sub(n, k)))


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


counts = input().split()
chislo = int(counts[0])
kolvo = int(counts[1])
for x in range(kolvo):
	if chislo % 10 == 0:
		chislo = chislo / 10
	else:
		chislo = chislo - 1
print(int(chislo))


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


(a, b) = input().split()
a = int(a)
b = int(b)
if 2 <= a <= 10 ** 9 and 1 <= b <= 50:
	for i in range(b):
		if int(str(a)[-1]) > 0:
			a = a - 1
		elif int(str(a)[-1]) == 0:
			a = int(a / 10)
	print(a)


def g(a):
	a = list(str(a))
	return a[len(a) - 1] == '0'

def f(a):
	if g(a) == True:
		return a // 10
	if g(a) == False:
		return a - 1
(a, b) = map(int, input().split())
for i in range(b):
	a = f(a)
print(a)


import re
s = input()
num = re.compile('\\d{10}|\\d{9}|\\d{8}|\\d{7}|\\d{6}|\\d{5}|\\d{4}|\\d{3}|\\d{2}|\\d')
ns = num.findall(s)
b = int(ns[1])
a = str(ns[0])
for i in range(b):
	if a[len(a) - 1] == '0':
		a = str(int(a) // 10)
	else:
		a = str(int(a) - 1)
print(int(a))


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


(chislo, k_v) = map(int, input().split())
while k_v > 0:
	if chislo % 10 != 0:
		chislo -= 1
		k_v -= 1
	elif chislo % 10 == 0:
		chislo //= 10
		k_v -= 1
	chislo = round(chislo)
print(chislo)


a = input()
b = a.split()
number = int(b[0])
times = int(b[1])
for i in range(times):
	f = str(number)
	if int(f[-1]) != 0:
		number = number - 1
	else:
		d = str(number)
		number = int(d[0:len(d) - 1])
print(number)


(a, b) = map(int, input().split())
for subtraction in range(b):
	if a % 10 != 0:
		a -= 1
	elif a % 10 == 0:
		a //= 10
print(a)


nums = input().split()
num = int(nums[0])
count = int(nums[1])

def sub(n):
	if n % 10 != 0:
		return n - 1
	else:
		return n // 10
k = 0
result = num
while k < count:
	result = sub(result)
	k += 1
print(result)


def wrongsubtraction():
	n = 0
	k = 0
	r = input()
	arr = [int(x) for x in r.split()]
	n = arr[0]
	k = arr[1]
	n = str(n)
	k = str(k)
	try:
		k = int(k)
		n = int(n)
	except:
		return 0
	n = int(n)
	if 2 <= n <= 1000000000:
		pass
	else:
		return 0
	k = int(k)
	if 1 <= k <= 50:
		pass
	else:
		return 0
	k = int(k)
	j = 0
	while k > j:
		n = str(n)
		f = len(n)
		lastdigit = int(n[f - 1])
		n = int(n)
		if lastdigit == 0:
			n = n / 10
			n = int(n)
		else:
			n = n - 1
		j += 1
	n = str(n)
	print(n)
wrongsubtraction()


l = [int(e) for e in input().split()]
a = l[0]
i = 0
while i < l[1]:
	if a % 10 != 0:
		a = a - 1
	else:
		a = a // 10
	i += 1
print(a)


lig = input().split(' ')
(ch, n) = (int(lig[0]), int(lig[1]))
for loop in range(n):
	if ch % 10 == 0:
		ch /= 10
	else:
		ch -= 1
print(int(ch))


x = str(input())
x1 = x.split(' ')
num = int(x1[0])
times = int(x1[1])
for i in range(times):
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
print(num)


(a, b) = map(int, input().split())
for _ in range(b):
	f = str(a)
	if f[-1] != '0':
		a = a - 1
	else:
		a = a // 10
print(a)


inn = input().split(' ')
num = int(inn[0])
k = int(inn[1])
while k != 0:
	temp = min(num % 10, k)
	k -= temp
	num -= temp
	if k == 0:
		break
	num //= 10
	k -= 1
print(num)


l = list(map(int, input().split()))
n = l[0]
k = l[1]
index = 0
while True:
	if index == k:
		break
	elif n % 10 == 0:
		n /= 10
		index += 1
	else:
		n -= 1
		index += 1
print(int(n))


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


def solve(number, iter):
	while 0 < iter:
		if number % 10 == 0:
			number = number / 10
		else:
			number -= 1
		iter -= 1
	return int(number)
(number, iteration) = input().split()
print(solve(int(number), int(iteration)))


a = input()
a = a.strip()
b = a.split(' ')
x = int(b[0])
y = int(b[1])
while True:
	if x % 10 != 0:
		x -= 1
		y -= 1
		if y == 0:
			break
	elif x % 10 == 0:
		x = x // 10
		y -= 1
		if y == 0:
			break
print(x)


def account(n, k):
	for _ in range(k):
		if not n % 10:
			n = n // 10
		elif n % 10:
			n = n - 1
	return n
(n, k) = map(int, input().split())
print(account(n, k))


(a, b) = map(int, input().split())
for _ in range(b):
	num = a % 10
	if num > 0:
		a -= 1
	elif num == 0:
		a /= 10
print(int(a))


nums = input()
nums = nums.split()
mainnum = int(nums[0])
sub = int(nums[1])
for i in range(sub):
	if mainnum % 10 != 0:
		mainnum = mainnum - 1
	elif mainnum % 10 == 0:
		mainnum = mainnum / 10
print(int(mainnum))


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


a = input().split()
n = int(a[0])
k = int(a[1])

def f(n, k):
	r = n % 10
	if r >= k:
		return n - k
	else:
		e = r + 1
		d = k - e
		return f(n // 10, d)
print(f(n, k))


numbers = input().split()
number = int(numbers[0])
numOfOperations = int(numbers[1])
for i in range(numOfOperations):
	if int(str(number)[-1]) == 0:
		number = number // 10
	else:
		number -= 1
print(number)


s = input().split()
n = int(s[0])
d = int(s[1])
for p in range(d):
	if n % 10 > 0:
		n = n - 1
	else:
		n = n // 10
print(n)


(n, k) = list(map(int, input().split()))
for i in range(0, k):
	ss = str(n)
	if ss[-1] == '0':
		n = int(ss[:-1])
	else:
		n = n - 1
print(n)


(n, k) = map(int, input().split())
while n:
	a = n % 10
	if k <= a or k == 0:
		n -= k
		break
	k -= a
	n //= 10
	k -= 1
print(n)


linea = input()
a = []
a = linea.split()
num = int(a[0])
time = int(a[1])
for x in range(0, time):
	x -= 1
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
print(int(num))


(n, k) = [int(i) for i in input().split()]
p = str(n)
l = list(p)
for i in range(k):
	if l[-1] == '0':
		l.pop()
	else:
		l[-1] = str(int(l[-1]) - 1)
for i in l:
	print(i, end='')


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


from math import modf
(n, k) = input().split()
n = int(n)
k = int(k)
for i in range(0, k):
	var = n / 10
	var = modf(var)
	if var[0] == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


number_and_sub = [int(x) for x in input().split(' ')]
base_number = number_and_sub[0]
subtract_times = number_and_sub[1]
while subtract_times > 0:
	if base_number % 10 == 0:
		base_number /= 10
		base_number = int(base_number)
	else:
		base_number -= 1
	subtract_times -= 1
print(base_number)


def go(num, k):
	while k != 0:
		if num % 10 != 0:
			num -= 1
		else:
			num //= 10
		k -= 1
	return num
(a, b) = list(map(int, input().split(' ')))
print(go(a, b))


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


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


import sys
(n, k) = tuple(map(int, sys.stdin.readline().split()))
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n //= 10
print(n)


(num, k) = [int(i) for i in input().split()]
while k != 0:
	if num % 10 is 0:
		num //= 10
	else:
		num -= 1
	k -= 1
print(num)


l = input().split()
N = int(l[0])
K = int(l[1])
arr = list(str(N))
vN = len(arr) - 1
for i in range(vN + 1):
	arr[i] = int(arr[i])
for i in range(K):
	if arr[vN] != 0:
		arr[vN] -= 1
	elif arr[vN] == 0:
		arr.pop(vN)
		vN -= 1
ans = 0
arr.reverse()
for i in range(len(arr)):
	ans += arr[i] * 10 ** i
print(ans)


(n, m) = map(int, input().split())
while 1:
	if n % 10 != 0:
		a = m
		m -= min(n % 10, m)
		n -= min(n % 10, a)
	else:
		n = n // 10
		m -= 1
	if m == 0:
		break
print(n)


import sys

def wrong_subtraction(n):
	if n % 10 == 0:
		return n / 10
	else:
		return n - 1
(n, k) = sys.stdin.readline().split()
n = int(n)
k = int(k)
for i in range(k):
	n = wrong_subtraction(n)
print(int(n))


def subtraction():
	data = []
	(num1, num2) = input().split()
	num1 = int(num1)
	num2 = int(num2)
	while num2 > 0:
		if num1 % 10 != 0:
			num1 -= 1
		else:
			num1 /= 10
		num2 -= 1
	print(int(num1))
subtraction()


(a, b) = tuple(map(int, input().split()))
for x in range(b):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


def check(num, steps):
	while steps != 0:
		if num % 10 == 0:
			num = num / 10
		else:
			num -= 1
		steps -= 1
	return num

def input_opts():
	input_list = input('').split()
	steps = int(input_list.pop())
	num = int(input_list.pop())
	return (num, steps)

def print_result(result):
	print(int(result))
(num, steps) = input_opts()
result = check(num, steps)
print_result(result)


(s, p) = map(int, input().split())
x = s
for i in range(0, p):
	r = x % 10
	if r == 0:
		x = x // 10
	else:
		x = x - 1
print(x)


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


import sys
for line in sys.stdin:
	(n, k) = [int(j) for j in line.split()]
	break
for i in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


(n, k) = list(map(int, input().split()))

def wrong_sub(n, k):
	while k > 0:
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
		k -= 1
	return n
print(wrong_sub(n, k))


def read() -> int:
	return int(input())

def read_list() -> list:
	return list(map(int, input().split()))
[n, k] = read_list()
n_str = str(n)
n_len = len(n_str)
ld = int(n_str[n_len - 1])
for i in range(0, k):
	if 0 == ld:
		n = int(n / 10)
	else:
		n -= 1
	n_str = str(n)
	n_len = len(n_str)
	ld = int(n_str[n_len - 1])
print(n)


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


def ws(h):
	if int(str(h)[-1]) == 0:
		h /= 10
	else:
		h -= 1
	return int(h)
(a, b) = list(map(int, input().split()))
for i in range(b):
	a = ws(a)
print(a)


inp = input().split()
a = int(inp[0])
b = int(inp[1])
m = 0
while m < b:
	if a % 10 == 0:
		a = a / 10
	elif a % 10 != 0:
		a = a - 1
	m = m + 1
print(int(a))


(s, m) = map(int, input().split())
s = str(s)
for i in range(m):
	if s[-1] == '0':
		s = s[:-1]
	else:
		s = s[:-1] + str(int(s[-1]) - 1)
print(s)


a = input()
inp = list(map(int, a.split(' ')))
nbstr = str(inp[0])
nb = int(inp[0])
for i in range(0, inp[1]):
	if nbstr[len(nbstr) - 1] == '0':
		nb = nb / 10
	else:
		nb = nb - 1
	nb = int(nb)
	nbstr = str(nb)
print(int(nb))


(n, k) = map(int, input().split())
n = str(n)
m = len(n) - 1
n = int(n)
for c in range(k):
	if n == 1:
		print(n)
		break
	n = str(n)
	if n[m] == '0':
		n = int(n)
		n = n / 10
		n = int(n)
		n = str(n)
		m = m - 1
	else:
		n = int(n)
		n = n - 1
print(n)


(n, k) = input().split()
count = 0
sum = 0
for i in range(int(k)):
	if n[-1] == '0':
		n = n[:-1]
	else:
		n = str(int(n) - 1)
print(n)


input = input().split()
integer = int(input[0])
subract_counter = int(input[1])
while subract_counter != 0:
	if integer % 10 == 0:
		integer = round(integer / 10)
	else:
		integer -= 1
	subract_counter -= 1
print(integer)


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


(a, b) = [int(x) for x in input().split(' ')]
j = 1
while j <= b:
	if a % 10 == 0:
		a = a / 10
		j += 1
	else:
		a = a - 1
		j += 1
print(int(a))


(n, k) = input().split()
n = int(n)
k = int(k)
step = 1
while step <= k:
	str_n = str(n)
	if str_n.endswith('0'):
		n = n // 10
	else:
		n = n - 1
	step += 1
print(n)


f = lambda x: x - 1 if x % 10 else x // 10
(a, b) = map(int, input().split())
for _ in range(b):
	a = f(a)
print(a)


def solution():
	(num, t) = (int(i) for i in input().split(' '))
	for _ in range(t):
		if num % 10 == 0:
			num = num // 10
		else:
			num -= 1
	print(num)
solution()


k = input().split()
x = int(k[0])
y = int(k[1])
count = 0
while count < y:
	count += 1
	if x % 10 == 0:
		x = x // 10
	else:
		x = x - 1
print(x)


line = input()
list = line.split()
(number, time) = list
number = int(number)
time = int(time)
while time != 0:
	if number % 10 == 0:
		number //= 10
		time -= 1
	else:
		number -= 1
		time -= 1
print(number)


def change(num):
	number = 0
	if num[-1] == '0':
		number = int(num) / 10
		number = int(number)
		num = str(number)
	else:
		number = int(num) - 1
		num = str(number)
	return num
(a, n) = input().split()
for i in range(int(n)):
	a = change(a)
	i += 1
print(a)


def wrong_subtraction(number: int, k: int) -> int:
	output = number
	while k != 0:
		if output % 10 == 0:
			output = output / 10
		else:
			output = output - 1
		k = k - 1
	return int(output)
(n, k) = input().split()
(n, k) = (int(n), int(k))
ans = wrong_subtraction(n, k)
print(ans)


arr = str(input()).split()
(num, count) = (int(arr[0]), int(arr[1]))
for i in range(count):
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
print(str(float(num))[:-2])


import datetime

class Sol:

	def __init__(self, n, k):
		self.n = n
		self.k = k

	def result(self):
		for _ in range(k):
			if self.n % 10 == 0:
				self.n = self.n // 10
			else:
				self.n = self.n - 1
		print(self.n)
(n, k) = map(int, input().split())
res = Sol(n, k)
res.result()


data = input().split(' ')
n = int(data[0])
k = int(data[1])
for _ in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n = n - 1
print('{}'.format(n))


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


line = input()
(a, b) = [int(n) for n in line.split()]
while --b:
	if a % 10 == 0:
		a = int(a / 10)
	else:
		a = a - 1
	b = b - 1
print(a)


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


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


l = list(map(int, input().split()))
n = l[0]
r = l[1]
while r > 0:
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
	r -= 1
print(n)


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


(number, tries) = input().split()
number = int(number)
tries = int(tries)
while tries != 0:
	if number % 10 == 0:
		number = number // 10
	else:
		number -= 1
	tries -= 1
print(number)


def get_last_number(numberN):
	aux = numberN
	x = aux % 10
	if x != 0:
		numberN -= 1
	if x == 0:
		numberN = int(numberN / 10)
	return numberN
str1 = str(input())
location = str1.find(' ')
str2 = str1[:location]
str3 = str1[location + 1:]
numberN = int(str2)
numberK = int(str3)
while numberK > 0:
	numberN = get_last_number(numberN)
	numberK -= 1
print(numberN)


def subtraction(number):
	result = 0
	if number % 10 == 0:
		result = number / 10
	else:
		result = number - 1
	return result
entrada = str(input())
n = entrada.split()[0]
k = entrada.split()[1]
(n, k) = (int(n), int(k))
for i in range(k):
	n = subtraction(n)
print(int(n))


lis = [int(i) for i in input().split()]
k = lis[0]
count = 0
while count < lis[1]:
	if lis[0] % 10 == 0:
		lis[0] = lis[0] // 10
		count += 1
	else:
		lis[0] = lis[0] - 1
		count += 1
print(lis[0])


(n, k) = input().split()
k = int(k)
n = n[::-1]
for a in range(k):
	if n[0] == '0':
		n = n[1:]
	else:
		n = chr(ord(n[0]) - 1) + n[1:]
print(n[::-1])


arr = list(map(int, input().strip().split(' ')))
n = int(arr[0])
strn = str(n)
k = int(arr[1])
for i in range(k):
	if strn[-1] == '0':
		n = int(n / 10)
		strn = str(n)
	elif strn[-1] != '0':
		n = n - 1
		strn = str(n)
print(n)


num = input().split()
val = int(num[0])
w = int(num[1])
while val > 0:
	if val % 10 >= w:
		print(val - w)
		break
	else:
		w = w - 1 - val % 10
		val = int(val / 10)
if val == 0:
	print(0)


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


class Solution:

	def solve(self, n, k):
		for i in range(0, k):
			n_str = list(str(int(n)))
			if n_str[-1] != '0':
				n -= 1
			else:
				n /= 10
		return int(n)
s = Solution()
inp = input().split()
n = int(inp[0])
k = int(inp[1])
print(s.solve(n, k))


def f(a, b):
	for i in range(b):
		if a % 10 == 0:
			a //= 10
		else:
			a -= 1
	return a
(a, b) = input().split()
print(f(int(a), int(b)))


def iip():
	return int(input())

def sip():
	return input()

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

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


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


var = input().split()
var = [int(x) for x in var]
num = var[0]
for x in range(var[1]):
	if num % 10 == 0:
		num = num / 10
	else:
		num -= 1
print(int(num))


def getLines(num):
	inputLines = []
	for i in range(0, num):
		line = input()
		if line:
			inputLines.append(line)
		else:
			break
	return inputLines

def notZeroPow(num, p):
	return True if num >= 1 and num <= pow(10, p) else False
lines = getLines(1)
result = 0
holder = 0
arr = lines[0].split()
for i in range(int(arr[1])):
	s = int(arr[0][-1])
	n = int(arr[0])
	if s > 0:
		n -= 1
		arr[0] = str(n)
	else:
		n /= 10
		arr[0] = str(int(n))
result = int(arr[0])
print(result)


(a, b) = map(int, input().strip().split()[:2])
res = a
for i in range(b):
	res = str(res)
	if res[-1] == '0':
		res = res[:-1]
	else:
		res = int(res) - 1
print(res)


from sys import stdin
for line in stdin:
	(n, k) = map(int, line.split())
	while k > 0:
		if n % 10:
			n -= 1
		else:
			n //= 10
		k -= 1
	print(n)


(n, k) = map(int, input().split())
li = []
while k != 0:
	if n % 10 == 0:
		n = n // 10
		li.append(n)
		k -= 1
	else:
		n = n - 1
		li.append(n)
		k -= 1
print(li[k - 1])


import sys
l1 = sys.stdin.readline()
a = int(l1.strip().split(' ')[0])
b = int(l1.strip().split(' ')[1])
for i in range(b):
	if str(a)[-1] == '0':
		temp = str(a)[:-1]
		a = int(temp)
	else:
		a -= 1
print(a)


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


(n, k) = tuple(map(int, input().split()))

def dec(n):
	if n % 10 == 0:
		return n // 10
	else:
		return n - 1
for i in range(k):
	n = dec(n)
print(n)


p = input()
l = p.split(' ')
n = l[0]
k = l[1]
n = int(n)
k = int(k)
c = 0
while c < k:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	c += 1
n = int(n)
print(n)


data = input()
spc = data.find(' ')
n = int(data[:spc])
k = int(data[spc + 1:])
i = 1
while i <= k:
	if n % 10 != 0:
		n = n - 1
	else:
		n = n / 10
	i = i + 1
print(int(n))


l = str(input('')).split()
for i in range(0, 2):
	l[i] = int(l[i])
e = l[0]
for i in range(0, l[1]):
	if e % 10 == 0:
		e = e // 10
	else:
		e = e - 1
print(e)


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


aa = input()
a = aa.split()
b = int(a[0])
c = int(a[1])
n = 0
while n < c:
	if b % 2 == 0 and b % 5 == 0:
		b = b / 10
	else:
		b = b - 1
	n = n + 1
print(int(b))


q = input().split()
num = int(q[0])
q = int(q[1])
for i in range(q):
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
print(int(num))


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())
(n, k) = M()
while k:
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
	k -= 1
print(n)


user = input()
location = user.find(' ')
sn = user[:location]
o = user[location + 1:]
subnum = int(sn)
operand = int(o)
for x in range(operand):
	if subnum % 10 == 0:
		subnum /= 10
	else:
		subnum -= 1
print(int(subnum))


(p, q) = map(int, input().split())
for i in range(0, q):
	if p % 10 != 0:
		p = p - 1
	else:
		p = p // 10
print(p)


a = input().split()
first = int(a[0])
k = int(a[1])
for i in range(k):
	s = ''
	s += str(first)
	if ord(s[-1]) > ord('0'):
		first -= 1
	else:
		first //= 10
print(first)


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


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


import sys

def main():
	vals = [int(x) for x in input().split(' ')]
	num = vals[0]
	sub_no = vals[1]
	for i in range(sub_no):
		if num % 10 == 0:
			num = num // 10
		else:
			num -= 1
	print(f'{num}')
	return num
main()


enter = list(map(int, input().split(' ')))
num = enter[0]
times = enter[1]
for i in range(times):
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
print(int(num))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
(n, k) = get_ints()
for x in range(k):
	if n % 10 == 0:
		n = int(n / 10)
	else:
		n = n - 1
print(n)


import sys
(n, k) = input().split()
n = list(n)
k = int(k)
while k > 0:
	if n[-1] == '0':
		k -= 1
		n.pop()
	else:
		x = int(n[-1])
		if x <= k:
			n[-1] = '0'
			k -= x
		else:
			n[-1] = str(int(n[-1]) - k)
			k = 0
print(''.join(n))


import sys

def gets():
	return sys.stdin.readline().strip()

def get():
	return int(sys.stdin.readline().strip())

def geti():
	return map(int, sys.stdin.readline().strip().split())

def getli():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = geti()
for _ in range(k):
	if n % 10:
		n -= 1
	else:
		n //= 10
print(n)


nk = input().split(' ')
(n, k) = (int(nk[0]), int(nk[1]))
for _ in range(k):
	if str(n)[-1] == '0':
		n = n // 10
	elif str(n)[-1] != '0':
		n -= 1
print(n)


def main():
	(n, k) = map(int, input().split())
	for _ in range(k):
		r = n % 10
		if r:
			n -= 1
		else:
			n //= 10
	print(n)
	pass
main()


(n, m) = [int(x) for x in input().split()]
while m > 0:
	r = n % 10
	if r == 0:
		n = int(n / 10)
	else:
		n -= 1
	m -= 1
print(n)


import sys

class MyInput:

	def __init__(self):
		self._lines = [x for s in sys.stdin for x in s.split()]
		self._next = 0

	def str(self):
		s = self._lines[self._next]
		self._next += 1
		return s

	def int(self):
		return int(self.str())
myInput = MyInput()
n = myInput.int()
k = myInput.int()
for _ in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(n, k) = input().split()
k = int(k)
n = list(map(int, n))
for _ in range(k):
	if n[-1] == 0:
		del n[-1]
	else:
		n[-1] -= 1
print(*n, sep='')


(n, k) = map(int, input().split())
y = n
g = str(n)
for __ in range(k):
	if int(g[-1]) > 0:
		y = y - 1
	else:
		y = y // 10
	g = str(y)
print(g)


ent = input().split()
n = int(ent[0])
aux = str(n)
k = int(ent[1])
for i in range(k):
	if aux[-1] == '0':
		n = int(n / 10)
	else:
		n = n - 1
	aux = str(n)
print(n)


X = input().split()
while int(X[1]) > 0:
	if int(X[0]) % 10 == 0:
		X[0] = int(X[0]) // 10
		X[1] = int(X[1]) - 1
	else:
		X[0] = int(X[0]) - 1
		X[1] = int(X[1]) - 1
print(X[0])


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


import sys

def tanyaYouIdiot(n, k):
	while n > 0:
		curr = n % 10
		if curr >= k:
			return n - k
		n = n // 10
		k -= curr + 1
	return n
(n, k) = map(int, input().split(' '))
print(tanyaYouIdiot(n, k))


def reduce(n, k):
	for i in range(k):
		if n % 10 != 0:
			n -= 1
		elif n % 10 == 0:
			n = n // 10
	return n

def main():
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	print(reduce(n, k))
main()


t_input = input().split(' ')
minuend = int(t_input[0])
repetitions = int(t_input[1])
for i in range(repetitions):
	if str(minuend)[-1] == '0':
		minuend = int(minuend / 10)
	else:
		minuend -= 1
print(minuend)


s = input()
(nb, n) = s.split()
nb = int(nb)
n = int(n)
for i in range(n):
	if nb % 10:
		nb -= 1
	else:
		nb //= 10
print(nb)


init = input().split(' ')
n = int(init[0])
k = int(init[1])
for i in range(k):
	n = list(str(n))
	if int(n[-1]) == 0:
		n = ''.join(n)
		n = int(int(n) / 10)
	else:
		n = ''.join(n)
		n = int(n) - 1
print(n)


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


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


def solve():
	inputs = list(map(int, input().split()))
	nums = inputs[0]
	times = inputs[1]
	for _ in range(times):
		if nums % 10 == 0:
			nums /= 10
		else:
			nums -= 1
	print(int(nums))
solve()


put = input().split(' ')
inp = int(put[0])
inp2 = int(put[1])
while inp2 > 0:
	inp2 -= 1
	if inp % 10 == 0:
		inp /= 10
	else:
		inp -= 1
print(int(inp))


(n, k) = [int(i) for i in input().split()]
c = 0
d = n
r = []
while d != 0:
	r.append(d % 10)
	d = d // 10
i = 0
while k != 0:
	if r[i] == k:
		r[i] = 0
		k = 0
		i += 1
		break
	if r[i] + 1 <= k:
		k = k - r[i] - 1
		r = r[1:]
	else:
		r[i] = r[i] - k
		i += 1
		k = 0
r.reverse()
for i in range(len(r)):
	print(r[i], end='')
print()


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


line = input().split()
num = int(line[0])
actions = int(line[1])
for i in range(actions):
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
print('%d' % num)


(N, K) = map(int, input().split())
s = str(N)
k = 0
while k != K:
	if s[-1] == '0':
		s = str(int(s) // 10)
	else:
		s = str(int(s) - 1)
	k += 1
print(s)


(integer, num_actions) = map(int, input().split())
for i in range(num_actions):
	if str(integer)[len(str(integer)) - 1] == '0':
		integer //= 10
	else:
		integer -= 1
print(integer)


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


def func():
	(n, k) = [str(n) for n in input().split()]
	num = []
	for j in n:
		num.append(int(j))
	for i in range(int(k)):
		if num[-1] > 0:
			num[-1] -= 1
		else:
			num.pop(-1)
	res = ''
	for i in num:
		res += str(i)
	print(int(res))
func()


(n, m) = map(int, input().split())
a = []
for i in str(n):
	a.append(i)
for i in range(m):
	if a[len(a) - 1] == '0':
		del a[len(a) - 1]
	else:
		a[len(a) - 1] = str(int(a[len(a) - 1]) - 1)
for i in a:
	print(i, end='')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, k) = iia()
while k > 0:
	if n % 10 == 0:
		n //= 10
		k -= 1
	else:
		n -= 1
		k -= 1
print(n)


import sys
(n, k) = map(int, next(sys.stdin).rstrip().split())
while k != 0:
	last_digit = n % 10
	if last_digit == 0:
		n = n // 10
		k -= 1
	elif last_digit <= k:
		n -= last_digit
		k -= last_digit
	else:
		n -= k
		k -= k
print(n)


def subtract(x, y):
	while y != 0:
		if x % 10 == 0:
			x /= 10
		else:
			x -= 1
		y -= 1
	return x
(n, a) = map(int, input().split())
print(int(subtract(n, a)))


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


import math
import os
import random
import re
import sys
l = [int(i) for i in input().split(' ')]
a = l[0]
k = l[1]
for x in range(k):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


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


from sys import stdin, stdout
arr = [int(x) for x in stdin.readline().split()]
n = arr[0]
k = arr[1]
for x in range(k):
	if not n % 10 == 0:
		n = n - 1
	else:
		n = n // 10
stdout.write(str(n))


(n, k) = map(int, input().split())
while k:
	tmp = str(n)
	tmp = tmp[-1]
	tmp = int(tmp)
	if tmp:
		n -= 1
	else:
		n /= 10
		n = int(n)
	k -= 1
print(n)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = input().split(' ')
n = int(n)
k = int(k)
for i in range(k):
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
print(int(n))


linha = input()
s = []
for a in linha.split():
	if a.isdigit():
		s.append(int(a))
numero = s[0]
operacoes = s[1]
for a in range(operacoes):
	if numero % 10 == 0:
		numero = numero / 10
	else:
		numero -= 1
print(int(numero))


x = input().split()
for a in range(2):
	x[a] = int(x[a])
change = x[0]
for b in range(x[1]):
	if change % 10 == 0:
		change = int(change / 10)
	else:
		change -= 1
print(change)


(n, k) = map(int, input().strip().split())
s = str(n)
while k != 0:
	if s[len(s) - 1] != '0':
		n -= 1
		s = str(n)
	elif s[len(s) - 1] == '0':
		n = int(n / 10)
		s = str(n)
	k -= 1
print(n)


def main():
	from sys import stdout
	(n, k) = map(int, input().split())
	for i in range(k):
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
	stdout.write(str(int(n)))
main()


from collections import deque
import math
(n, k) = map(int, input().split())
while k > 0:
	if n % 10 == 0:
		n = n // 10
		k -= 1
	else:
		temp = n % 10
		if temp >= k:
			n -= k
			k = 0
		else:
			k -= temp
			n -= temp
print(n)


import sys
data = sys.stdin.readlines()
num = int(data[0].split()[0])
k = 0
while k != int(data[0].split()[1]):
	if num % 10 == 0:
		num = int(num / 10)
	else:
		num -= 1
	k += 1
sys.stdout.write(str(num))


(a, b) = input().split()
(a, b) = (int(a), int(b))
count = 0
while count != b:
	digit = a % 10
	if digit == 0:
		a = a // 10
	else:
		a = a - 1
	count += 1
print(a)


(n, k) = map(int, input().split())
n = list(map(int, str(n)))
for i in range(0, k):
	l = len(n) - 1
	if n[l] != 0:
		n[l] -= 1
	else:
		n.pop(l)
print(''.join(map(str, n)))


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


s = input()
(n, k) = s.split()
k = int(k)
n = list(n)
for i in range(k):
	dig = n[-1]
	if dig == '0':
		n = n[:-1]
	else:
		n[-1] = str(int(n[-1]) - 1)
fin = ''
for i in n:
	fin += i
print(int(fin))


def a(m, n):
	while n:
		if m % 10 != 0:
			m -= 1
		else:
			m //= 10
		n -= 1
	return m
args = map(int, input().split(' '))
print(a(*args))


(nums, ks) = map(int, input().split(' '))
sums = 0
for i in range(ks):
	if nums % 10 == 0:
		nums = nums // 10
	elif nums % 10 != 0:
		nums = nums - 1
print(nums)


k = input()
(n, m) = k.split(' ')
m1 = int(m)
for x in range(m1):
	if n[len(n) - 1] == '0':
		n = n[0:len(n) - 1]
	else:
		n1 = int(n)
		n1 -= 1
		n = str(n1)
print(n)


(numbe, itr) = input().split()
temp = 0
for i in range(int(itr)):
	if int(numbe) % 10 == 0:
		temp = int(numbe) / 10
	else:
		temp = int(numbe) - 1
	numbe = temp
print(int(temp))


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


inData = input('')
lis = list(inData.split(' '))
k = int(lis[1])
n = int(lis[0])
answer = 0
i = 0
while i < k:
	if n % 10 == 0:
		answer = n // 10
		n = answer
		i += 1
	elif n % 10 != 0:
		answer = n - 1
		n = answer
		i += 1
print(answer)


(n, k) = input().split(' ')
k = int(k)
n = [x for x in n]
n.reverse()
while k > 0:
	if int(n[0]) - k >= 0:
		n[0] = str(int(n[0]) - k)
		k = 0
	else:
		k = abs(int(n[0]) - k) - 1
		n = n[1:]
n.reverse()
print(*n, sep='')


(n, k) = [int(x) for x in input().split()]
n = list(str(n))
for x in range(len(n)):
	n[x] = int(n[x])
for x in range(k):
	length = len(n) - 1
	if n[length] == 0:
		del n[length]
	else:
		n[length] -= 1
str1 = ''.join((str(e) for e in n))
print(str1)


def wrongSubstraction(n, k):
	for i in range(k):
		strNumber = str(n)
		numerLength = len(strNumber)
		if strNumber[numerLength - 1] != '0':
			n -= 1
		elif strNumber[numerLength - 1] == '0':
			n //= 10
	return n
(n, k) = [int(x) for x in input().split()]
print(wrongSubstraction(n, k))


(n, k) = input('').split(' ')
n = int(n)
k = int(k)
while k > 0:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	k = k - 1
print('{:.0f}'.format(n))


from collections import *
from math import *
import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
s = str(n)
while k:
	if s[-1] != '0':
		n = n - 1
		s = str(n)
	else:
		s = s[:-1]
		n = int(s)
	k -= 1
print(s)


(n, k) = [int(x) for x in input().split()]

def fmath(n):
	if n % 10 > 0:
		n = n - 1
	else:
		n = n // 10
	return n

def repeat(n, k):
	for i in range(k):
		n = fmath(n)
	print(n)
repeat(n, k)


(number, process) = input().split()
while int(process) > 0:
	number = str(number)
	if number[-1] != '0':
		number = int(number)
		number -= 1
	else:
		number = int(number)
		number /= 10
		number = int(number)
	process = int(process) - 1
print(int(number))


import sys
tanyas_input = input()
tanyas_input = tanyas_input.split()
(target, numberOfOperations) = (int(tanyas_input[0]), int(tanyas_input[1]))
while numberOfOperations > 0:
	if target % 10 == 0:
		target /= 10
	else:
		target -= 1
	numberOfOperations -= 1
print(int(target))


import math, collections, sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n //= 10
print(n)


(n, k) = input().split()
(n, k) = (int(n), int(k))

def solve():
	global n, k
	for i in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	return n
print(solve())


(a, k) = map(int, input().split())
i = 0
while i != k:
	if a % 10 != 0:
		i += 1
		a -= 1
		if i == k:
			break
	if a % 10 == 0:
		i += 1
		a = a // 10
		if i == k:
			break
print(a)


(n, k) = input('').split()
k = int(k)
largo = len(n)
nu = int(n)
for x in range(k):
	if n[largo - 1] != '0':
		nu = nu - 1
		n = str(nu)
	else:
		nu = nu / 10
		largo = largo - 1
print(int(nu))


def wrong_subtraction(n, k):
	i = 0
	result = n
	while i < k:
		if result % 10 == 0:
			result = result / 10
		else:
			result = result - 1
		i += 1
	return int(result)
(n, k) = input().split(' ')
(n, k) = (int(n), int(k))
print(wrong_subtraction(n, k))


(x, y) = map(str, input().split())
y = int(y)
for i in range(y):
	x = str(x)
	l = len(x)
	if x[l - 1] == '0':
		x = x[:len(x) - 1]
	else:
		x = int(x) - 1
print(x)


string = input('')
string = string.split()
number = int(string[0])
timesOfOperation = int(string[1])
i = 1
while i <= timesOfOperation:
	if str(number)[-1] == '0':
		number = int(number / 10)
	else:
		number -= 1
	i += 1
print(number)


(s, t) = list(map(int, input().split()))
for _ in range(t):
	if s % 10:
		s -= 1
	else:
		s //= 10
print(s)


def main():
	import sys
	(n, k) = [int(x) for x in sys.stdin.readline().strip('/n').split(' ')]
	for i in range(k):
		l_d = n % 10
		if l_d > 0:
			n -= 1
		else:
			n //= 10
	print(n)
main()


a = input()
a = a.split()
a1 = int(a[0])
a2 = int(a[1])
if a1 % 10 >= a2:
	print(a1 - a2)
else:
	while a2 > 0:
		if a1 % 10 == 0:
			a1 = a1 // 10
			a2 = a2 - 1
		elif a1 % 10 >= a2:
			a1 = a1 - a2
			a2 = 0
		else:
			a2 = a2 - a1 % 10
			a1 = a1 - a1 % 10
	print(a1)


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


p = input()
(n1, t1) = p.split()
n = int(n1)
t = int(t1)
d = 0
while d < t:
	if n % 10 == 0:
		n = n / 10
	else:
		n = n - 1
	d = d + 1
print(int(n))


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


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


inp = input(str())
num = inp.split(' ')
number = int(num[0])
times = int(num[1])
while times > 0:
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
	times -= 1
number = int(number)
print(number)


global k

def compute(n, k):
	if n % 10 ** k == 0:
		return str(n)[:len(str(n)) - k]
	while k > 0:
		last_digit = int(str(n)[-1])
		if last_digit:
			if last_digit - k > 0:
				return n - k
			else:
				k -= last_digit
				n -= last_digit
				last_digit = 0
		else:
			n = n // 10
			k -= 1
	return n
(n, k) = map(int, input().split())
print(compute(n, k))


import sys

def do_it(line):
	data = line.replace('\n', '').strip()
	number_1 = int(data.split(' ')[0])
	number_2 = int(data.split(' ')[1])
	for i in range(1, number_2 + 1):
		str_representation = str(number_1)
		if str_representation[-1] == '0':
			number_1 = int(number_1 / 10)
		else:
			number_1 -= 1
	print(number_1)
for line in sys.stdin:
	do_it(line)


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


inputt = input().split()
number = int(inputt[0])
for i in range(int(inputt[1])):
	if inputt[0][-1] == '0':
		number = number // 10
		inputt[0] = str(number)
	elif inputt[0][-1] != '0':
		number = number - 1
		inputt[0] = str(number)
print(number)


(n, k) = [int(n) for n in input().split()]
c = 0
while True:
	if n % 10 == 0:
		n = n / 10
		c += 1
	else:
		n = n - 1
		c += 1
	if c == k:
		break
print(int(n))


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


nk = str(input())
s = nk.split(' ')
n = int(s[0])
k = int(s[1])
while k > 0:
	d = n % 10
	if d == 0:
		n = n // 10
	else:
		n = n - 1
	k -= 1
print(n)


def sub(n):
	p = n % 10
	if p == 0:
		n = int(n / 10)
	else:
		n = n - 1
	return n
(n, k) = map(int, input().split())
for i in range(k):
	n = sub(n)
print(n)


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


import sys
input_ = input().split(' ')
num = int(input_[0])
ops = int(input_[1])
for i in range(ops):
	if num % 10 != 0:
		num -= 1
	else:
		num //= 10
print(str(num))
sys.exit()


(n, k) = input().split()
(n, k) = (int(n), int(k))

def operatii(k):
	global n
	if k == 0:
		return n
	elif n % 10 == 0:
		n = n // 10
		return operatii(k - 1)
	else:
		n = n - 1
		return operatii(k - 1)
print(operatii(k))


import sys

def wrong_substraction(n, k):
	while k > 0:
		if k <= n % 10:
			n = n - k
			k = 0
		else:
			k -= n % 10 + 1
			n = n // 10
	return n
inputs = sys.stdin.readline().split()
n = int(inputs[0])
k = int(inputs[1])
print(wrong_substraction(n, k))


(s, n) = map(int, input().split())
sx = str(s)
for i in range(n):
	if sx[-1] == '0':
		si = int(sx)
		sj = int(si / 10)
		sx = str(sj)
	else:
		si = int(sx)
		sj = si - 1
		sx = str(sj)
print(sx)


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


(n, k) = input().split()
k = int(k)
i = k
while i > 0:
	while i > 0 and n[-1] == '0':
		n = n[:-1]
		i -= 1
	if i > 0:
		di = min(i, int(n[-1]))
		n = n[:-1] + str(int(n[-1]) - di)
		i -= di
print(n)


def subtract(n):
	if n % 10 == 0:
		return n // 10
	return n - 1

def getline():
	line = input()
	return line

def main():
	(num, times) = [int(x) for x in getline().split()]
	for _ in range(times):
		num = subtract(num)
	print(num)
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

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

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, k) = LI()
	for _ in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	return n
print(main())


l1 = list(map(int, input().rstrip().split()))
a = l1[0]
b = l1[1]
for _ in range(b):
	c = a % 10
	if c != 0:
		a = a - 1
	else:
		a = a // 10
print(a)


def decrease(num):
	if num % 10 != 0:
		return num - 1
	else:
		return num // 10

def main():
	inputs = [int(x) for x in input().split()]
	n = inputs[0]
	k = inputs[1]
	for _ in range(k):
		n = decrease(n)
	print(n)
main()


def answer():
	a = input().split()
	(s, n) = (a[0], int(a[1]))
	k = 0
	while n:
		if s[-1] == '0':
			s = s[:-1]
		else:
			s = s[:-1] + str(int(s[-1]) - 1)
		n -= 1
	return int(s)
print(answer())


t = [int(i) for i in input().split()]
o = t[0]
for u in range(t[1]):
	if o % 10:
		o -= 1
	else:
		o //= 10
print(o)


import math
(x, y) = map(int, input().split())
for i in range(y):
	if x % 10 == 0:
		x = x / 10
	elif x % 10 != 0:
		x = x - 1
print(math.trunc(x))


def mCheckInputs(inputList):
	input1 = inputList[0][0]
	input2 = inputList[0][1]
	if 2 <= int(input1) <= pow(10, 9) and 1 <= int(input2) <= 50:
		pass
	else:
		exit(1)

def mHandleInputs(inputList):
	try:
		inputList.append(list(map(int, input().split())))
		if inputList[0].__len__() == 0 or inputList[0] == 1:
			exit(1)
		else:
			mCheckInputs(inputList)
	except ValueError as e:
		exit(1)

def mDoWork(inputList, outputList):
	n = int(inputList[0][0])
	k = int(inputList[0][1])
	for i in range(k):
		n = n - 1 if n % 10 != 0 else n // 10
	outputList.append(n if n > 0 else 0)

def mFormatResult(outputList):
	print(outputList[0])

def main():
	inputList = []
	mHandleInputs(inputList)
	outputList = []
	mDoWork(inputList, outputList)
	mFormatResult(outputList)
main()


a = input()
number = int(a.split(' ')[0])
subtractor = int(a.split(' ')[1])
for i in range(1, subtractor + 1):
	if number % 10 == 0 and number >= 10:
		number = number / 10
	else:
		number -= 1
print(int(number))


import sys
(n, k) = map(int, sys.stdin.readline().split())

def main():
	i = n
	for _ in range(k):
		if i % 10:
			i -= 1
		else:
			i //= 10
	return i
ans = main()
print(ans)


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


qkrq = input().split(' ')
N = int(qkrq[0])
k = int(qkrq[1])
while k > 0:
	k -= 1
	N = N - 1 if N % 10 != 0 else N // 10
print(N)


def subtract(number):
	if number % 10 == 0:
		return number / 10
	else:
		return number - 1
line = input().split()
n = int(line[0])
k = int(line[1])
for i in range(k):
	n = subtract(n)
print(str(int(n)))


(n, k) = input().split()
n = int(n)
k = int(k)
ns = str(n)
for i in range(k):
	l = len(ns)
	if ns[l - 1] != '0':
		n -= 1
		ns = str(n)
	else:
		n = n // 10
		ns = str(n)
print(n)


import math
import sys

def check_the_far_right_element(string_n):
	if string_n[len(string_n) - 1] == '0':
		return True
	else:
		return False

def main():
	(n, k) = map(int, input().split())
	if n < 2 or n > pow(10, 9) or k > 50 or (k < 1):
		sys.exit('error please check restrictions')
	else:
		while k > 0 and n > 0:
			string_n = str(n)
			if check_the_far_right_element(string_n):
				string_n = string_n[:-1]
				n = int(string_n)
			else:
				n -= 1
			k -= 1
		print(n)
main()


import sys
import math
import bisect

def main():
	(n, cnt) = map(int, input().split())
	for _ in range(cnt):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	print(n)
main()


def main():
	inputnk = str(input())
	lainput = inputnk.split()
	n = int(lainput[0])
	k = int(lainput[1])
	number = int(n) / 1
	for i in range(1, k + 1):
		str_n = str(number)
		if str_n[-3] != '0':
			number -= 1
		else:
			number /= 10
	print(int(number))
main()


import sys
import math
from collections import *

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

def get_list():
	return list(get_ints())

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0 + 7)
SEXYMOD = 998244353
MAXN = int(100000.0)
(n, k) = get_ints()
while k and n:
	if n % 10:
		n -= 1
	else:
		n //= 10
	k -= 1
print(n)


l = input()
n = ''
k = ''
for i in range(len(l)):
	if l[i] == ' ':
		n = l[:i]
		k += l[i + 1:len(l)]
int(n)
n = int(n)
k = int(k)

def wrong(n, k):
	while k > 0:
		if str(n)[-1] != '0':
			n = int(n - 1)
			k = k - 1
		else:
			n = int(n / 10)
			k = k - 1
	return n
print(wrong(n, k))


(x, s) = map(int, input().split())
i = 0
while i < s:
	i = i + 1
	if x % 10 == 0:
		x = x // 10
	else:
		x = x - 1
print(x)


i = list(map(lambda e: int(e), input().split(' ')))
v = i[0]
for _ in range(0, i[1]):
	if v % 10 == 0:
		v /= 10
	else:
		v -= 1
print(int(v))


s = str(input(''))
l = s.split(' ')
n = int(l[0])
k = int(l[1])
for i in range(1, k + 1):
	if n % 10 == 0:
		n = int(n / 10)
	elif n % 10 != 0:
		n = n - 1
print(n, end='')


s = [int(n) for n in input().split()]
a = s[0]
b = s[1]
n = 0
while 1:
	if a % 10 == 0:
		a = a // 10
	else:
		a -= 1
	n += 1
	if n == b:
		break
print(a)


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


def func(num, count):
	for i in range(count):
		if not num % 10:
			num //= 10
		else:
			num -= 1
	return num
(a, b) = [int(a) for a in input().split()]
print(func(a, b))


(a, k) = map(int, input().split())
a = str(a)
for _ in range(k):
	if a[-1] != '0':
		newA = a[:-1] + str(int(a[-1]) - 1)
	else:
		newA = a[:-1]
	a = newA
print(a)


x = input()
y = x.split(' ')
g = int(y[0])
f = int(y[1])
while f != 0:
	f -= 1
	if g % 10 != 0:
		g -= 1
	else:
		g = g // 10
print(g)


z = str(input())
z = z.split(' ')
nilai = int(z[0])
ulang = int(z[1])
haha = 0
while ulang > haha:
	if nilai % 10 == 0:
		nilai = nilai // 10
		haha += 1
	else:
		nilai -= 1
		haha += 1
print(nilai)


import random

def wrong_sub(n, k_range):
	for _ in k_range:
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
	return int(n)

def main(n, k):
	k_range = range(0, k)
	print(wrong_sub(n, k_range))
inp = input().split(' ')
(n, k) = (int(inp[0]), int(inp[1]))
main(n, k)


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


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


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


(n, k) = input().split()
k = int(k)
while k != 0:
	x = int(n[-1])
	if x >= k:
		print(int(n) - k)
		break
	else:
		k = k - x - 1
		n = n[:-1]
else:
	print(n)


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


def solve(n, k):
	for i in range(k):
		if n % 10 == 0:
			n //= 10
		elif n % 10 != 0:
			n -= 1
	return n
(n, k) = map(int, input().split())
print(solve(n, k))


initInput = str(input())
initList = initInput.split()
number = int(initList[0])
subtractions = int(initList[1])
for i in range(0, subtractions):
	if str(number).endswith('0') == False:
		number -= 1
	else:
		number = int(number / 10)
print(number)


def wrong_sub(nb, times):
	if times == 0:
		return nb
	if nb % 10 != 0:
		res = wrong_sub(nb - 1, times - 1)
	else:
		res = wrong_sub(int(nb / 10), times - 1)
	return res
(n, k) = map(int, input().split())
print(str(wrong_sub(n, k)))


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


a = list(input().split())
n = int(a[0])
s = int(a[1])
while s > 0:
	if n % 10 == 0:
		n = n / 10
	else:
		n -= 1
	s -= 1
print(int(n))


(n, k) = list(map(int, input().rstrip().split()))
for _ in range(k):
	r = n % 10
	if r != 0:
		n = n - 1
	else:
		n = n // 10
print(n)


action = input()
numAndTimes = action.split(' ')
num = int(numAndTimes[0])
times = int(numAndTimes[1])
for x in range(times):
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
print(int(num))


def solve(n, k):
	for _ in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n //= 10
	return n

def main():
	(n, k) = [int(_) for _ in input().split()]
	ans = solve(n, k)
	print(ans)
main()


(number, times) = (int(a) for a in input().strip().split(' '))
for x in range(times):
	if number % 10 == 0:
		number = number // 10
	else:
		number -= 1
print(number)


import sys
for line in sys.stdin.readlines():
	(num, k) = line.split()
	num = int(num)
	k = int(k)
	while k > 0:
		if num % 10 == 0:
			num //= 10
		else:
			num -= 1
		k -= 1
	print(num)


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


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


def wrongSubtraction(n, k):
	for i in range(k):
		lastDigit = n % 10
		if lastDigit == 0:
			n /= 10
		else:
			n -= 1
	return int(n)

def main():
	vals = input().split(' ')
	n = int(vals[0])
	k = int(vals[1])
	print(wrongSubtraction(n, k))
main()


(n, k) = map(int, input().split())
for i in [0] * k:
	n = str(n)
	if n[-1] == '0':
		n = int(int(n) / 10)
	else:
		n = int(n) - 1
print(n)


(a, n) = [int(x) for x in input().strip().split()]
while a % 10 < n:
	n -= a % 10 + 1
	a = a // 10
a -= n
print(a)


v = list(input().split())
s = list(v[0])
p = []
t = ''
for item in s:
	p.append(int(item))
for i in range(int(v[1])):
	if p[-1] == 0:
		p = p[:-1]
	else:
		p[-1] -= 1
for item in p:
	t += str(item)
print(t)


n = list(map(int, input().split()))
k = n[1]
p = n[0]
for x in range(k):
	if p % 10 != 0:
		s = p % 10
		p = p // 10 * 10 + (s - 1)
	else:
		p //= 10
print(p)


(num, count) = list(map(int, input().strip().split()))[:2]
t = 0
while t < count:
	if num % 10 == 0:
		num = num // 10
	else:
		num -= 1
	t += 1
print(num)


def wrong_subtraction(num, total_subtractions):
	subtractions = 0
	while subtractions < total_subtractions:
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
		subtractions += 1
	print(int(num))
(number, num_subtractions) = input().split()
(number, num_subtractions) = (int(number), int(num_subtractions))
wrong_subtraction(number, num_subtractions)


p = str(input()).split()
n = int(p[0])
i = int(p[1])
for _ in range(i):
	if str(n)[-1] == '0':
		n = n // 10
	else:
		n -= 1
print(n)


def WrongSubtraction():
	(n, k) = map(int, input().split())
	while k:
		if n % 10:
			n -= 1
		else:
			n /= 10
		k -= 1
	return int(n)
a = WrongSubtraction()
print(a)


def read_numbers():
	return [int(s) for s in input().strip().split(' ')]

def main():
	(n, k) = read_numbers()
	for _ in range(k):
		if n % 10 != 0:
			n = n - 1
		else:
			n = n // 10
	print(n)
main()


print((lambda x: (lambda f, x, y: f(f, x, y))(lambda f, x, y: x if y == 0 else f(f, x // 10, y - 1) if x % 10 == 0 else f(f, x - 1, y - 1), x[0], x[1]))(tuple(map(int, input().split()))))


def solve(n, t):
	for i in range(t):
		if n % 10 != 0:
			n -= 1
		else:
			n /= 10
	return int(n)

def main():
	ins = input().split()
	(num, times) = (int(ins[0]), int(ins[1]))
	result = solve(num, times)
	print(result)
main()


raw_input = input()
split_input = raw_input.split()
first_number = int(split_input[0])
substractions = int(split_input[1])
for iteration in range(substractions):
	numbers_last_digit = first_number % 10
	if numbers_last_digit == 0:
		first_number = first_number // 10
	else:
		first_number = first_number - 1
print(first_number)


cnt = input()
cnt = cnt.split(' ')
br1 = int(cnt[0])
br2 = int(cnt[1])
for i in range(br2):
	if br1 % 10 == 0:
		br1 = br1 / 10
	else:
		br1 = br1 - 1
print(int(br1))


n = input().rsplit()
(num, x) = (int(n[0]), int(n[1]))

def doido(num):
	if num % 10 == 0:
		num //= 10
	else:
		num -= 1
	return num

def main(num, x):
	for i in range(x):
		num = doido(num)
	return num
print(main(num, x))


def getAnswer(n, cycle):
	if cycle == 0:
		return n
	if n % 10 == 0:
		return getAnswer(int(n / 10), cycle - 1)
	else:
		return getAnswer(n - 1, cycle - 1)
inputStr = input()
(n, cycle) = inputStr.split(' ')
print(getAnswer(int(n), int(cycle)))


from sys import stdin, stdout
arr = stdin.readline().split()
k = int(arr[0])
r = int(arr[1])
for i in range(r):
	if k % 10 == 0:
		k = k / 10
	else:
		k -= 1
stdout.write(str(int(k)))


try:
	(a, b) = map(int, input().split())
	while b >= 1:
		r = [int(x) for x in str(a)]
		if r[-1] == 0:
			a = a // 10
		else:
			a = a - 1
		b = b - 1
	print(a)
except:
	pass


numbers = input().split()
n = int(numbers[0])
k = int(numbers[1])

def solve(_n: int, _k: int):
	for i in range(_k):
		if _n % 10 == 0:
			_n = _n / 10
		else:
			_n = _n - 1
	return int(_n)
result = solve(n, k)
print(result)


(n, k) = map(int, input().split(' '))
l = [i for i in str(n)]
for j in range(0, k):
	if l[-1] != str(0):
		n = n - 1
	else:
		n = int(n / 10)
	l = [a for a in str(n)]
print(n)


def subtract(start, steps):
	current = start
	for _ in range(steps):
		if current % 10 == 0:
			current //= 10
		else:
			current -= 1
	return current

def main():
	args = input().split()
	start = int(args[0])
	steps = int(args[1])
	print(subtract(start, steps))
main()


class Substrations:

	def __init__(self, number, times):
		for _ in range(0, times):
			if number % 10 == 0:
				number = int(number / 10)
			else:
				number = number - 1
		print(number)
(number, times) = input().split()
number = int(number)
times = int(times)
s = Substrations(number, times)


def incor_substraction():
	(n, k) = input().split()
	k = int(k)
	n = list(map(int, list(n)))
	while k >= 0:
		if k > n[-1]:
			k = k - (n[-1] + 1)
			del n[-1]
		else:
			n[-1] -= k
			break
	return ''.join(list(map(str, n)))
print(incor_substraction())


(N, K) = map(int, input().split())
for _ in range(K):
	if str(N)[-1] != '0':
		N -= 1
	else:
		N //= 10
print(N)


def sub(num, k):
	for i in range(k):
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
	return int(num)
list_in = input().split()
num = int(list_in[0])
k = int(list_in[1])
print(sub(num, k))


(x, y) = input().split()
k = int(y)
n = int(x)
while k != 0:
	num = n
	while num != 0:
		rem = num % 10
		if rem != 0:
			n = n - 1
			break
		n = n // 10
		break
	k = k - 1
print(n)


(n, k) = map(int, input().split())
n = str(n)
k2 = 0
i2 = 0
for i in range(len(n) - 1, -1, -1):
	if int(n[i]) >= k:
		k2 = int(n[i]) - k
		i2 = i
		break
	k -= int(n[i]) + 1
for i in range(i2):
	print(n[i], end='')
print(k2)


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


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


inputer = input().split()
base = int(inputer[0])
gap = int(inputer[1])
for i in range(gap):
	if base % 10 == 0:
		base /= 10
	else:
		base -= 1
print(int(base))


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


(n, k) = map(int, input().split())
for i in range(k):
	while n % 10 != 0 and k >= 1:
		k -= 1
		n -= 1
	if n % 10 == 0 and k >= 1:
		k -= 1
		n //= 10
print(n)


(number, repeats) = map(int, input().split())
string_num = str(number)
while repeats > 0:
	if string_num[len(string_num) - 1] == '0':
		number = number // 10
	else:
		number -= 1
	string_num = str(number)
	repeats -= 1
print(number)


def main():
	(n, k) = map(int, input().split())
	for i in range(k):
		if n % 10 != 0:
			n -= 1
			continue
		if n % 10 == 0:
			n /= 10
	print(int(n))
main()


input1 = input()
(fir, sec) = input1.split(' ')
sec = int(sec)
strlist = list(fir)
while True:
	if int(strlist[-1]) >= sec:
		gap = int(strlist[-1]) - sec
		strlist[-1] = str(gap)
		break
	else:
		sec = sec - int(strlist[-1]) - 1
		strlist = strlist[:-1]
print(''.join(strlist))


import sys

def wrong_subtraction():
	(num, times) = [int(x) for x in input().split()]
	for _ in range(times):
		if num % 10 != 0:
			num -= 1
		else:
			num //= 10
	print(num)
wrong_subtraction()


def wrong(num, c):
	while c > 0:
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
		c -= 1
	return int(num)
no = str(input())
no = list(map(int, no.split()))
num = no[0]
c = no[1]
print(wrong(num, c))


(x, y) = input().split(' ')
l = list(x)
s = ''
y = int(y)
for i in range(y):
	if l[-1] != '0':
		l[-1] = str(int(l[-1]) - 1)
	else:
		del l[-1]
for i in l:
	s += i
print(int(s))


def subtract(n, k):
	while k:
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
		k -= 1
	return int(n)
(n, k) = input().rstrip().split()
print(subtract(int(n), int(k)))


(x, y) = input().split()
if int(x[len(x) - 1]) >= int(y):
	print(x[0:len(x) - 1] + str(int(x[len(x) - 1]) - int(y)))
else:
	z = int(y) - int(x[len(x) - 1])
	t = int(x[0:len(x) - 1])
	for _ in range(z - 1):
		if t % 10 == 0:
			t = t // 10
		else:
			t -= 1
	print(t)


import sys

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


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


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


from sys import stdin

def main():
	(k, n) = [int(x) for x in stdin.readline().strip().split()]
	while n > 0:
		pre = k % 10
		if pre == 0:
			k = k // 10
		elif pre != 0:
			k = k - 1
		n = n - 1
	print(k)
main()


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


from math import ceil
import sys, bisect, copyreg, copy, statistics, os

def inp():
	return sys.stdin.readline().strip()

def IIX():
	return (int(x) for x in sys.stdin.readline().split())

def II():
	return int(inp())

def LI():
	return list(map(int, inp().split()))

def L(x):
	return list(x)

def out(var):
	return sys.stdout.write(str(var))
(n, k) = IIX()
while k > 0:
	if n % 10 != 0:
		n = n - 1
	elif n % 10 == 0:
		n = n // 10
	k -= 1
out(n)


a = list(input().split())
val1 = str(a[0])
val2 = int(a[1])
for i in range(val2):
	temp = int(val1[-1])
	if temp == 0:
		val = int(val1)
		val = int(val / 10)
		val1 = str(val)
	elif temp != 0:
		val = int(val1)
		val = val - 1
		val1 = str(val)
print(val1)


(n, k) = input().split()
k = int(k)
ls = list(n)
while k > 0:
	k -= 1
	if ls[len(ls) - 1] != '0':
		ls[len(ls) - 1] = str(int(ls[len(ls) - 1]) - 1)
	else:
		del ls[len(ls) - 1]
print(''.join(ls))


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


def get_values():
	(num, times) = list(map(int, input().split()))
	for i in range(times):
		if num % 10 == 0:
			num /= 10
		else:
			num -= 1
	return print(int(num))
get_values()


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


import sys
t = sys.stdin.readline().split(' ')
val = int(t[0])
sub = int(t[1])
for i in range(0, sub):
	if val % 10 == 0:
		val = val // 10
	else:
		val -= 1
print(val)


nums = list(map(int, input().split()))
(x, y) = (nums[0], nums[1])
while y > 0:
	if x % 10 == 0:
		x = int(x / 10)
	else:
		x = x - 1
	y = y - 1
print(x)


import math
a = input('')
(n, rows) = a.split()
n = int(n)
k = int(rows)
i = 0
while i < k:
	c = n / 10
	if math.floor(c) == c:
		n = c
	else:
		n = n - 1
	i = i + 1
print(int(n))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
(n, k) = rint()
for i in range(k):
	if n % 10:
		n -= 1
	else:
		n //= 10
print(n)


data = input(' ').split(' ')
number = int(data[0])
subtraction_counter = int(data[1])
for i in range(0, subtraction_counter):
	if number % 10 != 0:
		number -= 1
	else:
		number //= 10
print(number)


def program(n):
	for i in range(k):
		if str(n).endswith('0'):
			n = int(n / 10)
		else:
			n -= 1
	return n
a = list(map(int, input().strip().split()))
n = a[0]
k = a[1]
print(program(n))


(n, k) = map(int, input().split())
for i in range(k):
	temp = int(str(n)[-1])
	if temp >= 1 and temp <= 9:
		n -= 1
	else:
		n //= 10
print(n)


def dec(n):
	if n % 10 == 0:
		return n // 10
	else:
		return n - 1

def fan(n, k):
	if k == 1:
		return dec(n)
	else:
		return fan(dec(n), k - 1)
(n, k) = map(int, input().split())
print(fan(n, k))


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


(N, n) = map(int, input().split())
for i in range(n):
	if str(N).endswith('0'):
		N //= 10
	else:
		N -= 1
print(N)


(num, time) = input().split()
num = int(num)
time = int(time)
i = 0
while i < time:
	if num % 10 != 0:
		num = num - 1
	else:
		num = num / 10
	i += 1
print(int(num))


debug = False
if debug:
	f = None

	def new_input():
		global f
		if f == None:
			f = open('input.txt')
		return f.readline()
	input = new_input

def subsub(n, op):
	if op == 0:
		return n
	x = n % 10
	if x == 0:
		return subsub(n // 10, op - 1)
	else:
		pp = min(op, x)
		n -= pp
		return subsub(n, op - pp)
(n, k) = list(map(int, input().split()))
print(subsub(n, k))


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


user_input = input()
(number, steps) = [int(i) for i in user_input.strip().split()]
for _ in range(0, steps):
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
print(f'{int(number)}')


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


inp = list(map(int, input().split()))
a = inp[0]
k = inp[1]
while k > 0:
	if a == 0:
		break
	elif a % 10 == 0:
		a /= 10
	else:
		a -= 1
	k -= 1
print(int(a))


def wrong_sub(n, k):
	if k == 0:
		return n
	if n % 10 == 0:
		return wrong_sub(n // 10, k - 1)
	else:
		return wrong_sub(n - 1, k - 1)
inp = input().split(' ')
print(wrong_sub(int(inp[0]), int(inp[1])))


def subalgorithm(n, k):
	for _ in range(k):
		if n % 10 == 0:
			n /= 10
		else:
			n -= 1
	return int(n)
(n, k) = map(int, input().strip().split(' '))
print(subalgorithm(n, k))


(var1, var2) = input().split()
num = int(var1)
subs = int(var2)
for i in range(subs):
	if num % 10 == 0:
		num = num / 10
	else:
		num = num - 1
print('{}'.format(int(num)))


(n, k) = map(int, input().split())
ans = 0
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	elif n % 10 != 0:
		n = n - 1
print(n)
exit


from sys import stdin

def substract(number: int, times: int) -> int:
	if number % 10 == 0:
		result = int(number / 10)
	else:
		result = number - 1
	if times == 1:
		return result
	return substract(result, times - 1)
(number, times) = [int(s) for s in stdin.readline().split(' ')]
print(substract(number, times))


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


x_input = input().split()
x = int(x_input[0])
for ___ in range(int(x_input[1])):
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
print(int(x))


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	(N, K) = getInts()
	while K:
		if N % 10 == 0:
			N //= 10
		else:
			N -= 1
		K -= 1
	return N
ans = solve()
print(ans)


(x, y) = [int(a) for a in input().split()]
a = 0
while y != 0:
	z = str(x)
	y = y - 1
	if z[-1] == '0':
		x = int(x / 10)
	else:
		x = x - 1
print(x)


(n, k) = list(map(int, input().split()))
if (n < 2 or n > pow(10, 9)) or (k < 1 or k > 50):
	exit(0)
else:
	for x in range(k):
		ld = n % 10
		if ld > 0:
			n = n - 1
		else:
			n = n / 10
	print(int(n))


(n, k) = input().split()
n = int(n)
k = int(k)
for i in range(k):
	n_str = str(n)
	if len(n_str) == 1:
		n = n - 1
	elif int(n_str[-1]) != 0:
		n = n - 1
	else:
		n = n / 10
		n = int(n)
print(n)


def subtract(a, b):
	lv = b
	while lv >= 1:
		if a % 10 == 0:
			a = a // 10
			lv = lv - 1
		else:
			a = a - 1
			lv = lv - 1
	print(a)
n = input().split(' ')
subtract(int(n[0]), int(n[1]))


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


values = input()
(num, subtractTimes) = values.split()
num = int(num)
subtractTimes = int(subtractTimes)
while subtractTimes > 0:
	if num % 10 == 0:
		num /= 10
	else:
		num -= 1
	subtractTimes -= 1
print(int(num))


(number, no_of_subtractions) = input().split()
number = int(number)
no_of_subtractions = int(no_of_subtractions)
counter = 1
while counter <= no_of_subtractions:
	if number % 10 == 0:
		number /= 10
	else:
		number -= 1
	counter += 1
print(int(number))


a = input().split()
h = []
b = list(a[0])
c = [h.append(int(i)) for i in b]
for i in range(int(a[-1])):
	if h[-1] == 0:
		h.remove(h[-1])
	else:
		h[-1] -= 1
c1 = [print(i, end='') for i in h]


import sys, math
from collections import Counter, deque, defaultdict
mod = 10 ** 9 + 7
INF = float('inf')

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

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, k) = inpl()
for _ in range(k):
	if n % 10:
		n -= 1
	else:
		n //= 10
print(n)


def ans(n, k):
	while k > 0:
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
		k -= 1
	return n
nk = list(map(int, input().strip().split()))
print(ans(nk[0], nk[1]))


(n, k) = map(int, input().split())
i = 1
while i <= k and n > 0:
	d = n % 10
	if d != 0:
		n -= 1
	else:
		n /= 10
	i += 1
print(int(n))


(number, times) = input().split(' ')
i = 0
while i != int(times):
	if number[-1] == '0':
		number = number[:-1]
	else:
		number = str(int(number) - 1)
	i += 1
print(number)


nk = input('').split()
n = int(nk[0])
k = int(nk[1])
num = [int(digits) for digits in str(n)]
for i in range(k):
	if num[-1] == 0:
		num.pop(-1)
	else:
		num[-1] = num[-1] - 1
for j in range(0, len(num)):
	num[j] = str(num[j])
print(int(''.join(num)))


import sys
line = sys.stdin.readline().strip().split(' ')
n = int(line[0])
ops = int(line[1])
for i in range(ops):
	if n % 10 == 0:
		n = n // 10
	else:
		n -= 1
print(n)


[n, k] = input().split(' ')
n = eval(n)
k = eval(k)
while k > 0:
	k = k - 1
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


from sys import stdin, stdout

def tanya_subtract(x: int, y: int) -> int:
	tanya_result = x
	for i in range(y):
		if tanya_result % 10 == 0:
			tanya_result //= 10
		else:
			tanya_result -= 1
	return tanya_result
(x, y) = map(int, stdin.readline().rstrip().split())
stdout.write(str(tanya_subtract(x, y)) + '\n')


import sys
input = sys.stdin.readline

def main():
	(num, k) = list(map(int, input().split()))
	while k:
		if num % 10 == 0:
			num //= 10
		else:
			num = num - 1
		k = k - 1
	print(num)
main()


(x, y) = input().split()
res = x
for i in range(int(y)):
	if res[-1] == '0':
		res = str(int(res) // 10)
	elif not res[-1] == '0':
		res = str(int(res) - 1)
print(res)


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


def sub(number, n):
	for i in range(n):
		if str(number)[-1] == '0':
			number = int(number / 10)
		else:
			number -= 1
	print(number)
inp = input()
(number, n) = inp.split()
sub(int(number), int(n))


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


a = list(map(int, input().strip().split()))[:2]
num = a[0]
for i in range(a[1]):
	if num % 10 == 0:
		num = int(num / 10)
	else:
		num -= 1
print(num)


(n, k) = map(int, input().split())
l = list(str(n))
for i in range(len(l)):
	l[i] = int(l[i])
while k > 0:
	if l[len(l) - 1] == 0:
		l.pop(len(l) - 1)
	else:
		l[len(l) - 1] -= 1
	k = k - 1
str_nums = [str(_) for _ in l]
s = ''.join(str_nums)
print(s)


(a, k) = input().split(' ')
k = int(k)
val = int(a)
for i in range(k):
	if a[-1] == '0':
		val /= 10
		val = int(val)
	else:
		val -= 1
	a = str(val)
print(val)


b = dict(zip('123456789', '012345678'))
(inp, t) = input().split()
for i in range(int(t)):
	inp = inp[:-1] if inp[-1] is '0' else f'{inp[:-1]}{b[inp[-1]]}'
print(inp)


inp = input()
inp = inp.split(' ')
n = int(inp[0])
k = int(inp[1])
result = n
for i in range(k):
	if result % 10 != 0:
		result = result - 1
	elif result % 10 == 0:
		result = int(result / 10)
print(result)


(number, k) = [int(whatever) for whatever in input().split()]
while k > 0:
	if number % 10 == 0:
		number = number // 10
	else:
		number -= 1
	k -= 1
print(number)


(n, d) = map(int, input().split())

def subs(a, b):
	(a, r) = divmod(a, 10)
	if r >= b:
		return a * 10 + (r - b)
	else:
		return subs(a, b - r - 1)
print(subs(n, d))


str = input()
lst = str.split()
m = lst[0]
n = lst[1]
intm = int(m)
intn = int(n)
lenm = len(m)
for i in range(intn):
	if intm % 10 == 0:
		intm = intm / 10
	else:
		intm = intm - 1
print(int(intm))


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


def pro(num):
	last = int(str(num)[-1])
	if last:
		num -= 1
	else:
		num //= 10
	return num
(n, k) = list(map(int, input().split()))
for _ in range(k):
	n = pro(n)
print(n)


(n, k) = input().split(' ')
k = int(k)
n = list(map(int, n[::-1]))
for (i, val) in enumerate(n):
	if k == 0:
		break
	if n[i] > 0:
		if n[i] > k:
			n[i] -= k
			k = 0
		else:
			k -= n[i]
			n[i] = 0
	if k == 0:
		break
	k -= 1
	n[i] = -1
n = list(map(lambda x: '' if x == -1 else str(x), n[::-1]))
print(''.join(n))


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


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


r = lambda : map(int, input().split())
(n, w) = r()
while w:
	if n % 10:
		n -= 1
	else:
		n /= 10
	w -= 1
print(int(n))


(x, y) = input().split()
a = int(x)
l = len(x)
c = 0
while c < int(y):
	if x[l - 1] == '0':
		a = a // 10
		x = str(a)
		l -= 1
	else:
		a = a - 1
		x = str(a)
		l = l
	c += 1
print(x)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
x = 0
for x in range(k):
	if n % 10 == 0:
		n = n // 10
	elif n > 0:
		n = n - 1
	else:
		break
print(n)


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


l = lambda : map(int, input().split())
(x, y) = l()
for i in range(y):
	x = [x - 1, x // 10][x % 10 == 0]
print(x)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
if n > 1000000000:
	exit(0)
elif n < 2:
	exit(0)
elif k > 50:
	exit(0)
elif k < 1:
	exit(0)
for i in range(0, k, 1):
	if int(repr(n)[-1]) == 0:
		n = int(n / 10)
	else:
		n = int(n - 1)
print(int(n))


(input_n, opr) = input().split()
input_n = int(input_n)
opr = int(opr)
for _ in range(opr):
	if input_n % 10 == 0:
		input_n = input_n / 10
	else:
		input_n = input_n - 1
print(int(input_n))


(n, k) = input().split()
k = int(k)
while k > 0:
	v = int(n[-1])
	if v != 0 and v > k:
		n = n[0:-1] + str(v - k)
		break
	elif v != 0 and v <= k:
		k -= v
		n = n[0:-1] + '0'
	else:
		n = n[0:-1]
		k -= 1
print(n)


import sys

def wrong_substraction(n_str, k):
	n = int(n_str)
	last_digit = n_str[-1]
	for i in range(k):
		if last_digit == '0':
			n /= 10
		else:
			n -= 1
		n_str = str(int(n))
		last_digit = n_str[-1]
	return n_str
for line in sys.stdin:
	n_k = line.split()
	(n, k) = (n_k[0], int(n_k[1]))
	answer = wrong_substraction(n, k)
	print(answer)


def WrongSubtraction(numOne, numTwo):
	for index in range(numTwo):
		rem = numOne % 10
		if rem == 0:
			numOne /= 10
		else:
			numOne -= 1
	return int(numOne)

def main():
	subValues = input().split(' ')
	numOne = int(subValues[0])
	numTwo = int(subValues[1])
	print(WrongSubtraction(numOne, numTwo))
main()


b = list(input().split(' '))
for k in range(int(b[1])):
	if b[0][-1] == '0':
		b[0] = b[0][:len(b[0]) - 1]
	else:
		b[0] = str(int(b[0]) - 1)
print(int(b[0]))


(num, n) = map(int, input().split())
for x in range(n):
	if num % 10 != 0:
		num -= 1
	elif num % 10 == 0:
		num = num // 10
print(num)


(s, n) = input().split()
n = int(n)
while n > 0:
	n -= 1
	if s.endswith('0'):
		s = s[:-1]
	else:
		k = ord(s[-1]) - 1
		s = s[:-1] + chr(k)
print(s)


in_ = input()
value = in_.split(' ')
for i in range(int(value[1])):
	if value[0][-1] is '0':
		p = int(value[0]) // 10
		value[0] = str(p)
	else:
		value[0] = str(int(value[0]) - 1)
print(value[0])


(n, k) = map(int, input().split())
cnt = 0
for i in range(k):
	modulo = int(n % 10)
	if modulo == 0:
		n = int(n / 10)
	if modulo > 0:
		n -= 1
print(n)


import sys
information = [int(x) for x in sys.stdin.readline().strip().split()]
ans = information[0]
for i in range(information[1]):
	if ans % 10 == 0:
		ans = ans / 10
	else:
		ans = ans - 1
print(int(ans))


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


def wrong_sub():
	inp = input().split(' ')
	num = int(inp[0])
	count = int(inp[1])
	while count > 0:
		if num % 10 != 0:
			num -= 1
		else:
			num //= 10
		count -= 1
	print(num)
wrong_sub()


nk = input().strip().split()
n = list(nk[0])
k = int(nk[1])
for i in range(k):
	if n[-1] == '0':
		n.pop(-1)
	else:
		n[-1] = str(int(n[-1]) - 1)
print(''.join(n))


(a, b) = map(str, input().split())
b = int(b)
a = [int(i) for i in a]
i = 0
while i < b:
	if a[len(a) - 1] != 0:
		a[len(a) - 1] = a[len(a) - 1] - 1
	else:
		del a[len(a) - 1]
	i += 1
print(*a, sep='')


str = input()
(ns, ks) = str.split()
n = int(ns)
k = int(ks)
for x in range(0, k):
	last = n % 10
	if last == 0:
		n = int(n / 10)
	else:
		n -= 1
print(n)


def wrong(n):
	number = n[0]
	times = n[1]
	for i in range(times):
		if str(number)[-1] == '0':
			number //= 10
		else:
			number -= 1
	print(number)
n = list(map(int, input().split()))
wrong(n)


(x, n) = input().split(' ')
x = int(x)
n = int(n)
for i in range(0, n):
	r = int(x % 10)
	if r == 0:
		x = x / 10
	if r != 0:
		x = x - 1
x = int(round(x))
print(x)


t = lambda z, k: z if k == 0 else t(z - 1 if z % 10 else z // 10, k - 1)
(a, b) = map(int, input().split())
print(t(a, b))


def solve(n, k):
	for _ in range(k):
		if n % 10 != 0:
			n -= 1
		else:
			n /= 10
	return int(n)
input_line = input()
(n, k) = input_line.strip().split()
n = int(n)
k = int(k)
sol = solve(n, k)
print(sol)


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


(x, y) = [int(x) for x in input().split()]
while y > 0:
	d = x % 10
	if d == 0:
		x = x / 10
		y = y - 1
	elif d < y:
		x = x - d
		y = y - d
	else:
		x = x - y
		y = 0
print(int(x))


(number, k) = input().split()
k = int(k)
number = list(number)
for i in range(k):
	if number[-1] != '0':
		number[-1] = str(int(number[-1]) - 1)
	else:
		number = number[:-1]
print(*number, sep='')


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


(n, k) = input().split()
n = int(n)
k = int(k)
if 2 <= n <= 10 ** 9 and 1 <= k <= 50:
	for i in range(k):
		if int(str(n)[-1]) > 0:
			n = n - 1
		elif int(str(n)[-1]) == 0:
			n = int(n / 10)
	print(n)


(s, p) = map(int, input().split())
for _ in range(p):
	s = s - 1 if s % 10 else s // 10
print(s)


import sys
lst = list(map(int, str(sys.stdin.readline()).split()))
a = lst[0]
b = lst[1]
for i in range(b):
	if a % 10 == 0:
		a = a // 10
	else:
		a = a - 1
print(a)


chaine = input()
L = chaine.split(' ')
n = int(L[0])
k = int(L[1])
l = list(str(n))
for i in range(k):
	if l[len(l) - 1] != '0':
		s = int(l[len(l) - 1]) - 1
		l[len(l) - 1] = str(s)
	else:
		k = l.pop()
print(int(''.join(l)))


(n, s) = map(int, input().split())
for loops in range(s):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
print(n)


def solve(n, k):
	if k == 0:
		return n
	if n % 10 != 0:
		return solve(n - 1, k - 1)
	else:
		return solve(n // 10, k - 1)
(n, k) = list(map(int, input().split()))
print(solve(n, k))


import sys

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


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


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


input = input()
finder = input.index(' ')
num = input[:finder]
repetition = int(input[finder + 1:])
strNum = str(num)
i = 1
while i <= repetition:
	intNum = int(strNum)
	if strNum[len(strNum) - 1] == '0':
		intNum = intNum // 10
		strNum = str(intNum)
	else:
		intNum -= 1
		strNum = str(intNum)
	i += 1
print(strNum)


def wrongSubtraction(Number, NoOfOperation):
	while NoOfOperation > 0:
		if Number % 10 == 0:
			Number = Number // 10
		else:
			Number -= 1
		NoOfOperation -= 1
	return Number
(NumStr1, NumStr2) = input().split(' ')
finalNumber = wrongSubtraction(int(NumStr1), int(NumStr2))
print(finalNumber)


def WrongSubtraction():
	(n, k) = map(int, input().split())
	for i in range(k):
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
	print(n)
	return None

def main():
	WrongSubtraction()
main()


def wrong_subtraction(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
	print('%d' % n)
raw = input()
inp = raw.strip().split()
n = int(inp[0])
k = int(inp[1])
wrong_subtraction(n, k)


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


(l, b) = input().strip().split()[:3]
l = int(l)
b = int(b)
st = str(l)
for x in range(1, b + 1):
	if st[len(st) - 1] != '0':
		l = l - 1
		st = str(l)
	elif st[len(st) - 1] == '0':
		l = int(l / 10)
		st = str(l)
print(st)


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


def fun(a=0):
	if a % 10 == 0:
		return a // 10
	else:
		return a - 1
(n, k) = input().split(' ')
(n, k) = (int(n), int(k))
for i in range(k):
	n = fun(n)
print(n, end='')


import math
inputstr = input()
inputstrlist = inputstr.split()
n = int(inputstrlist[0])
k = int(inputstrlist[1])
i = 1
while i <= k:
	custstr = str(n)
	if custstr[len(custstr) - 1] == '0':
		n = math.trunc(n / 10)
	else:
		n -= 1
	i += 1
print(n)


girdi = input()
girdi = girdi.split(sep=' ')
n = int(girdi[0])
k = int(girdi[1])
i = 0
while i < k:
	i += 1
	if n % 10 != 0:
		n -= 1
	else:
		n /= 10
print(int(n))


s = str(input())
s1 = []
s1 = s.split(' ')
n = int(s1[0])
k = int(s1[1])
while True:
	if k == 0:
		break
	if n % 10 < k:
		k -= n % 10
		k -= 1
		n = n // 10
	elif n % 10 >= k:
		n -= k
		k = 0
print(n)


def get_sorted_numlist():
	list_in = list(input().split())
	list_out = []
	for k in list_in:
		list_out += [int(k)]
	return list_out

def main():
	list_num = get_sorted_numlist()
	a = list_num[0]
	for _ in range(list_num[1]):
		if a % 10 == 0:
			a = int(a / 10)
		else:
			a -= 1
	print(a)
main()


import sys
input = sys.stdin.readline

def result():
	(x, y) = map(int, input().split())
	while y > 0:
		if x % 10 == 0:
			x = x / 10
		else:
			x = x - 1
		y -= 1
	print(int(x))
result()


(n, k) = input().split()
k = int(k)
n = list(n)
while k > 0:
	if n[-1] != '0':
		g = int(n[-1])
		n.pop(-1)
		n.insert(len(n), str(g - 1))
		k -= 1
	elif n[-1] == '0':
		g = int(n[-1])
		n.pop(-1)
		k -= 1
n2 = ''.join(n)
print(n2)


def subtractor(num, k):
	if k == 0:
		return num
	elif num % 10 == 0:
		return subtractor(num // 10, k - 1)
	else:
		return subtractor(num - 1, k - 1)
inp = input()
num = int(inp.split()[0])
k = int(inp.split()[1])
print(subtractor(num, k))


from sys import stdin

def wrong_subtract_recursive(val, times):
	if times <= 0:
		return val
	last_digit = val % 10
	if times > last_digit:
		return wrong_subtract_recursive(val // 10, times - last_digit - 1)
	else:
		return val - min(last_digit, times)
data = [int(x) for x in stdin.readline().split()]
print(wrong_subtract_recursive(data[0], data[1]))


import math
import sys
import itertools
import itertools

def sa(Type=int):
	return [Type(x) for x in input().split()]

def solve(t):
	(n, k) = sa()
	for x in range(k):
		if n % 10 == 0:
			n //= 10
		else:
			n -= 1
	print(n)
solve(0)


numberOfTestCases = 1
for test in range(numberOfTestCases):
	(num, k) = [int(i) for i in input().split(' ')]
	while k:
		if not num % 10 == 0:
			num -= 1
		else:
			num = num / 10
		k -= 1
	print(int(num))
	pass


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


ip = input().split()
k = int(ip[1])
res = int(ip[0])
for i in range(1, k + 1):
	n = list(str(res))
	if n[-1] != '0':
		res = res - 1
	else:
		res = res // 10
print(res)


(first_num, second_num) = input().split()
first_num = int(first_num)
second_num = int(second_num)
for i in range(second_num):
	if first_num % 10 == 0:
		first_num = first_num / 10
	else:
		first_num -= 1
print(int(first_num))


a = input()
s = a.split(' ')
s1 = int(s[0])
s2 = int(s[1])
while s2 > 0:
	if s1 % 10 == 0:
		s1 /= 10
		s2 -= 1
	elif s1 % 10 > s2:
		s1 -= s2
		s2 = 0
	else:
		s2 -= s1 % 10
		s1 -= s1 % 10
print(int(s1))


(n, k) = map(int, input().split())
while k:
	if n > 9:
		l = str(n)[-1]
		if l == '0':
			n = n // 10
			k -= 1
		else:
			n -= min(int(l), k)
			k -= min(int(l), k)
	else:
		n -= k
		k = 0
print(n)


a = input()
b = a.split(' ')
b[0] = int(b[0])
b[1] = int(b[1])
c = 0
while c < b[1]:
	if str(b[0])[-1] == '0':
		b[0] = b[0] // 10
	else:
		b[0] = b[0] - 1
	c = c + 1
print(b[0])


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


_1 = '236a'
_2 = '339a'
_3 = '266a'
_4 = '96a'
_5 = '236a'
_6 = '281a'
_7 = '546a'
_8 = '116a'
_9 = '977a'
(n, k) = map(int, input().split())
for i in range(k):
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


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


def wrong_substraction(num1, num2):
	for i in range(num2):
		if num1 % 10 == 0:
			num1 //= 10
		else:
			num1 -= 1
	return num1
numbers = input()
(num1, num2) = [int(num) for num in numbers.split(' ')]
result = wrong_substraction(num1, num2)
print(result)


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


while 1:
	try:
		(x, y) = [int(e) for e in input().split()]
	except:
		break
	while y > 0:
		if x % 10 == 0:
			x //= 10
		else:
			x -= 1
		y -= 1
	print(x)


(N, K) = [int(c) for c in input().split()]
i = N
k = 0
while k < K:
	if i % 10 == 0:
		i //= 10
	else:
		i -= 1
	k += 1
print(i)


s = input()
l = s.split()
x1 = l[0]
x2 = int(l[1])
while x2 > 0:
	x3 = list(x1)
	n1 = x3[len(x3) - 1]
	if int(n1) == 0:
		s = x1[0:len(x1) - 1]
	else:
		s = x1[0:len(x1) - 1] + str(int(n1) - 1)
	x1 = s
	x2 = x2 - 1
print(x1)


(n, k) = map(int, input().split())

def l(n):
	return n % 10
while k:
	k -= 1
	if l(n):
		n -= 1
	else:
		n //= 10
print(n)


(a, b) = map(int, input().split())

def f(a, b):
	if a % 10 >= b:
		return a - b
	return f(a // 10, b - a % 10 - 1)
print(f(a, b))


def tanyaCalc(n, k):
	while k > 0:
		if n >= 10 and n % 10 == 0:
			n = n / 10
		else:
			n = n - 1
		k -= 1
	print(int(n))
(n, k) = [int(x) for x in input().split()]
tanyaCalc(n, k)


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


(num, t) = map(int, input().split())
temp = num
for i in range(t):
	if num % 10 != 0:
		num = num - 1
	elif num % 10 == 0:
		num = num / 10
print(int(num))


def get_input():
	return [int(e) for e in input().split()]

def operation(x):
	return x // 10 if x % 10 == 0 else x - 1

def solve():
	(n, k) = get_input()
	for i in range(k):
		n = operation(n)
	print(n)
solve()


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


lb = input().split()
l = int(lb[0])
b = int(lb[1])
while b != 0:
	b -= 1
	if l % 10 == 0:
		l //= 10
	else:
		l -= 1
print(l)


(n, k) = [int(el) for el in input().split(' ')]
for i in range(k):
	if str(n).endswith('0'):
		n = round(n / 10)
	else:
		n -= 1
print(n)


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


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


def wrong_subtraction(N, K):
	while K > 0:
		if N % 10 != 0:
			sub = min(N % 10, K)
			K -= sub
			N -= sub
		else:
			N //= 10
			K -= 1
	return N
(N, K) = [int(x) for x in input().split()]
print(wrong_subtraction(N, K))


(n, k) = input().split()
k = int(k)
n = [int(i) for i in n]
for j in range(k):
	if n[-1] != 0:
		n.append(n[-1] - 1)
		del n[-2]
	else:
		del n[-1]
ans = ''
for i in n:
	ans += str(i)
print(ans)


def decrease(n):
	if n % 10 == 0:
		return n / 10
	return n - 1
(n, p) = map(int, input().split())
for i in range(p):
	n = decrease(n)
print(int(n))


arr = input().split()
new_arr = [int(item) for item in arr]
for num in range(new_arr[1]):
	if new_arr[0] % 10 != 0:
		new_arr[0] -= 1
	else:
		new_arr[0] //= 10
print(new_arr[0])


list1 = input().split(' ')
list2 = [int(a) for a in list1]
x = list2[0]
y = list2[1]
for i in range(1, y + 1):
	if x % 10 == 0:
		x = x / 10
	else:
		x = x - 1
print(int(x))


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans
mod = int(1000000000.0) + 7

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
(n, k) = ninp()
for i in range(k):
	if n % 10 == 0:
		n = n // 10
	else:
		n = n - 1
p(n)


from math import ceil
from collections import Counter
from typing import List
(n, k) = [int(i) for i in input().split(' ', 2)]

def solution(n: int, k: int) -> int:
	while k > 0:
		last_digit = n % 10
		if last_digit > 0:
			n -= 1
		else:
			n /= 10
		k -= 1
	return int(n)
print(solution(n, k))


input = list(input().split(' '))
currentNumber = int(input[0])
subtractions = int(input[1])
while subtractions > 0:
	if currentNumber % 10 == 0:
		currentNumber = int(currentNumber / 10)
	else:
		currentNumber = currentNumber - 1
	subtractions = subtractions - 1
print(currentNumber)


def fun(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = int(n / 10)
		else:
			n = n - 1
	print(n)
(N, K) = map(int, input().split())
fun(N, K)


def main():
	(target, number_of_operations) = map(int, input().split(' '))
	for _ in range(number_of_operations):
		if target % 10 == 0:
			target = target // 10
		else:
			target = target - 1
	print(target)
main()


(s, i) = input().split()
i = int(i)
for j in range(i):
	if s[-1] == '0':
		s = s[:len(s) - 1]
	else:
		s = s[:len(s) - 1] + chr(ord(s[-1]) - 1)
print(s)


import re

def numberGatherer():
	generalArray = re.findall('[+-]?\\d+', input(''))
	for index in range(0, len(generalArray)):
		generalArray[index] = int(generalArray[index])
	return generalArray
tanyaArray = numberGatherer()
for element in range(0, tanyaArray[1]):
	if tanyaArray[0] % 10 == 0:
		tanyaArray[0] = tanyaArray[0] / 10
	else:
		tanyaArray[0] = tanyaArray[0] - 1
print(int(tanyaArray[0]))


import sys
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
(n, k) = M()
while k:
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
	k -= 1
print(n)


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


(n, k) = [int(x) for x in input('').split()]
while k > 0:
	if str(n)[-1] == '0':
		n = int(n) / int(10)
		n = int(n)
		k -= 1
		continue
	else:
		n -= int(1)
		k -= 1
		continue
print(n)


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	lst = [0] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			lst[p] = p
			for i in range(p * p, n + 1, p):
				if prime[i] == True:
					prime[i] = False
					lst[i] = p
		p = p + 1
	for i in range(1, n + 1):
		if lst[i] == 0:
			lst[i] = i
	mylist = [0] * (n + 1)
	for i in range(2, n + 1):
		mylist[lst[i]] = mylist[lst[i]] + 1
	return mylist

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	if len(factors) == 2:
		return True
	else:
		return False

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(string, k) = get_ints()
string = str(string)
l = len(string)
while k > 0:
	if string[-1] == '0':
		string = string[:l - 1]
		k = k - 1
		l = l - 1
	else:
		string = string[:l - 1] + str(int(string[-1]) - 1)
		k = k - 1
print(string)


def zero(n):
	n = str(n)
	n = n[0:len(n) - 1]
	n = int(n)
	return n
(n, k) = map(int, input().split())
while k > 0:
	n = str(n)
	n = n[::-1]
	if n[0] == '0':
		n = n[::-1]
		n = zero(n)
	else:
		n = n[::-1]
		n = int(n)
		n = n - 1
	k = k - 1
	pass
print(n)


(value, no) = input().split()
value = int(value)
no = int(no)
for each in range(0, no):
	if value % 10 == 0:
		value = value / 10
	else:
		value -= 1
print(int(value))


def wrongSubtraction(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = n / 10
		else:
			n -= 1
	print(str(int(n)))
val = input()
vals = val.split(' ')
wrongSubtraction(int(vals[0]), int(vals[1]))


import sys

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


def subtraction(n):
	if n % 10 == 0:
		return n // 10
	else:
		return n - 1
a = input().split()
n = int(a[0])
k = int(a[1])
for _ in range(k):
	n = subtraction(n)
print(n)


nums = input().split(' ')
number = nums[0]
num_of_actions = nums[1]
for i in range(0, int(num_of_actions)):
	if int(number[-1]) != 0:
		number = str(int(number) - 1)
	else:
		number = str(int(number[:-1]))
print(number)


(a, n) = list(map(int, input().strip().split()))
for _ in range(n):
	if a % 10 == 0:
		a /= 10
	else:
		a -= 1
print(int(a))


(n, k) = input().split()
k = int(k)
while k:
	if n[-1] == '0':
		n = n[:len(n) - 1]
		k -= 1
	else:
		temp = min(int(n[-1]), k)
		n = str(int(n) - temp)
		k -= temp
print(n)


def solve(tup):
	(n, k) = tup
	for i in range(k):
		last_d = int(str(n)[-1])
		n = int(str(n)[:-1]) if last_d == 0 else n - 1
	return n
print(solve(map(int, input().split())))


c = [int(i) for i in input().split()]
a = c[0]
d = 0
while d != c[1]:
	d = d + 1
	if a % 10 == 0:
		a = a // 10
	elif a % 10 != 0:
		a = a - 1
print(a)


from math import *
from typing import DefaultDict
(n, k) = [int(n) for n in input().split()]
while k > 0:
	if n % 10 == 0:
		n /= 10
		k -= 1
	else:
		n -= 1
		k -= 1
print(int(n))


(number, count) = [int(a) for a in input().split()]
for i in range(count):
	if str(number)[-1] != '0':
		number = int(number) - 1
	else:
		number = str(number)[:-1]
print(number)


def subtract(number, k):
	if k == 0:
		print(number)
		return
	if number < 10:
		number = number - k
		print(number)
		return
	if number % 10 == 0:
		number = number // 10
		subtract(number, k - 1)
	else:
		number = number - 1
		subtract(number, k - 1)
(n, k) = input().split()
subtract(int(n), int(k))


def inc(x):
	if x % 10:
		return x - 1
	else:
		return x // 10
(n, k) = map(int, input().split())
for i in range(k):
	n = inc(n)
print(n)


[n, k] = [int(m) for m in input().split()]
while n > 0 and k > 0:
	if n % 10 < k:
		k = k - n % 10 - 1
		n = n // 10
	else:
		n = n - k
		k = 0
print(n)


(number, times) = input().split()
for i in range(int(times)):
	if number[len(number) - 1] != '0':
		number = str(int(number) - 1)
	elif number[len(number) - 1] == '0':
		number = number[:len(number) - 1]
print(number)


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


def woo(a, b):
	while b != 0:
		if a % 10 == 0:
			a //= 10
		else:
			a -= 1
		b -= 1
	return a
(a, b) = map(int, input().split())
print(woo(a, b))


read = lambda : map(int, input().split())
(n, k) = map(int, input().split())
while k:
	if n % 10:
		steps = min(n % 10, k)
		n -= steps
		k -= steps
	else:
		n //= 10
		k -= 1
print(n)


a = [int(q) for q in input().strip().split()]
for k in range(a[1]):
	if int(a[0]) % 10 == 0:
		a[0] /= 10
		a[0] = int(a[0])
	else:
		a[0] -= 1
print(a[0])


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


def main():
	(number, substractions) = input().split()
	number = int(number)
	substractions = int(substractions)
	for x in range(substractions):
		if number % 10 != 0:
			number -= 1
		else:
			number = number / 10
	print(int(number))
main()


input_line = input()
inputs = input_line.split()
n = int(inputs[0])
k = int(inputs[1])
for i in range(k):
	if str(n)[-1:] == '0':
		n = n / 10
		n = int(n)
	else:
		n = n - 1
print(int(n))


s = input()
l = len(s)
n = s.index(' ')
t = int(s[0:n])
o = int(s[n + 1:l])
for i in range(0, o):
	if t % 10 == 0:
		t = t / 10
	else:
		t = t - 1
print(int(t))


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


(k, j) = input().split()
(k, j) = (int(k), int(j))
for _ in range(j):
	if k % 10 == 0:
		k = int(k / 10)
	else:
		k = k - 1
print(k)


from sys import stdin
(n, k) = [int(x) for x in stdin.readline().rstrip().split()]

def wrong_subs(n, k):
	for i in range(k):
		if n % 10 == 0:
			n = n // 10
		else:
			n -= 1
	print(n)
wrong_subs(n, k)


def h():
	(n, k) = input().split(' ')
	k = int(k)
	total = 0
	for (i, j) in enumerate(n[::-1]):
		l = int(j)
		if total + l + 1 >= k:
			break
		total += l + 1
	if i != 0:
		n = n[:-i]
	last = str(int(n[-1]) - k + total)
	if last == '-1':
		last = ''
	n = n[:-1] + last
	print(n)
h()


(n, k) = map(int, input().split())
A = list(map(int, str(n)))
A.reverse()
p = 0
for i in range(k):
	if A[p] == 0:
		p += 1
	else:
		A[p] -= 1
for i in range(len(A) - 1, p - 1, -1):
	print(A[i], end='')
print()


def subtraction(num):
	if num % 10 == 0:
		return num // 10
	return num - 1
(n, k) = [int(i) for i in input().split()]
for _ in range(k):
	n = subtraction(n)
print(n)


(n, k) = input().split()
k = int(k)
n = list(n)
op = 0
while op < k:
	if n[-1] == '0':
		n = n[:-1]
		op += 1
	else:
		toDo = min(k - op, int(n[-1]))
		op += toDo
		n[-1] = str(int(n[-1]) - toDo)
print(''.join(n))


(girdi, step) = map(int, input().split())
for _ in range(step):
	if girdi % 10 == 0:
		girdi //= 10
	else:
		girdi -= 1
print(girdi)


def wrong_sub(nbr, i):
	for _ in range(i):
		if nbr % 10 == 0:
			nbr //= 10
		else:
			nbr -= 1
	return nbr
args = input().split()
print(wrong_sub(int(args[0]), int(args[1])))


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


from sys import stdin

def sol(num, k):
	for i in range(k):
		if num % 10 == 0:
			num = num // 10
		else:
			num -= 1
	return num
(number, times) = map(int, stdin.readline().split())
print(sol(number, times))


s = list(map(int, input().split(' ')))
count = 0
while count < s[1]:
	if s[0] % 10 == 0:
		s[0] //= 10
	else:
		s[0] -= 1
	count += 1
print(s[0])


try:
	(n, k) = list((int(i) for i in input().split(' ')))
	if n >= 2 and n <= 10 ** 9 and (k >= 1) and (k <= 50):
		for i in range(k):
			if str(n)[-1] != '0':
				n -= 1
			elif str(n)[-1] == '0':
				n = int(n / 10)
		print(n)
except:
	pass


import os
(num, time) = list(map(int, input().rstrip().split()))
for _ in range(time):
	if num >= 10 and num % 10 == 0:
		num = num // 10
	else:
		num = num - 1
print(num)


(a, b) = map(int, input('').split())
n = 0
while n < b:
	c = str(a)
	d = len(c)
	e = c[d - 1]
	f = int(e)
	if f == 0:
		a = int(a / 10)
	else:
		a = a - 1
	n += 1
print(int(a))


a = input()
b = str(a)
c = []
c = b.split()
d = c[0]
n = int(d)
e = c[1]
k = int(e)
while k > 0:
	k -= 1
	if n % 10 == 0:
		n /= 10
	else:
		n -= 1
print(int(n))


(z, temp) = map(int, input().split())
while temp > 0:
	z = str(z)
	lastDigit = z[len(z) - 1]
	if int(lastDigit) == 0:
		z = int(z) // 10
	else:
		z = int(z) - 1
	temp -= 1
print(z)


(a, b) = input().split()
b = int(b)
i = len(a)
while b >= 0:
	i -= 1
	b -= int(a[i]) + 1
for g in range(i):
	print(a[g], end='')
print(abs(b) - 1)


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


str = input()
str = str.split(' ')
k = int(str[1])
n = []
for d in str[0]:
	n.append(int(d))
for x in range(k):
	if n[-1] == 0:
		del n[-1]
	else:
		n[-1] = n[-1] - 1
	x = x + 1
for i in n:
	print(i, end='')


inputting = input()
inputting = inputting.split(' ')
input_1 = inputting[0]
input_2 = inputting[1]
for i in range(0, int(input_2)):
	if str(input_1[-1]) != '0':
		input_1 = int(input_1)
		input_1 = int(input_1 - 1)
		input_1 = str(input_1)
	elif str(input_1[-1]) == '0':
		input_1 = int(input_1)
		input_1 = int(input_1 / 10)
		input_1 = str(input_1)
print(int(input_1))


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


variables = input()
numbers = variables.split(' ')
n = numbers[0]
n = int(n)
k = numbers[1]
k = int(k)
for i in range(k):
	string_n = str(n)
	n_length = len(string_n)
	last_value = int(string_n[n_length - 1])
	if last_value == 0:
		n = int(n / 10)
	else:
		n = n - 1
print(n)


(subtracted_num, subtraction_count) = list(map(int, input().split()))
if len(str(subtracted_num)) == 1:
	result = subtracted_num - subtraction_count
else:
	for index in range(subtraction_count):
		if subtracted_num % 10 == 0:
			subtracted_num //= 10
		else:
			subtracted_num -= 1
	result = subtracted_num
print(result)


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


def Substract(n, k):
	ans = n
	for i in range(k):
		temp = str(ans)
		if temp[-1] == '0':
			ans = int(ans / 10)
		else:
			ans = ans - 1
	return ans
data = [int(x) for x in input().split()]
print(Substract(data[0], data[1]))


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


number = str(input(''))
numbs = number.split(' ')
x = int(numbs[0])
y = int(numbs[1])
for loop in range(y):
	if x % 10 == 0:
		x /= 10
	else:
		x -= 1
print(int(x))


(m, n) = map(int, input().split())
t = []
c = 0
s = ''
for i in range(n):
	if m % 10 == 0:
		m = m / 10
	else:
		m = m - 1
print(int(m))


(n, k) = [str(x) for x in input().split()]
n = list(n)
k = int(k)
for i in range(k):
	q = int(n[len(n) - 1])
	if q == 0:
		del n[len(n) - 1]
	if q > 0:
		n[len(n) - 1] = q - 1
for m in range(len(n)):
	print(n[m], end='')


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


x = list(map(int, input().split()))

def f(a, b):
	if a % 10 == 0 and b > 0:
		return f(a / 10, b - 1)
	elif a % 10 != 0 and b != 0:
		return f(a - 1, b - 1)
	else:
		return int(a)
print(f(x[0], x[1]))


inp = input().split()
num = int(inp[0])
times = int(inp[1])
e = 0
while e < times:
	if num % 10 != 0:
		num -= 1
		e += 1
	else:
		num /= 10
		e += 1
print(int(num))


(num, times) = list(map(int, input().split()))
for _ in range(times):
	if num % 10 == 0:
		num = int(num / 10)
		continue
	if num % 10 != 0:
		num -= 1
		continue
print(num)


import sys
it = (int(x) for x in sys.stdin.read().split())
n = next(it)
k = next(it)
for i in range(k):
	if n % 10 != 0:
		n -= 1
	else:
		n //= 10
print(n)


x = list(map(int, input().split()))
t = x[0]
for i in range(x[1]):
	if t % 10 == 0:
		t = t // 10
	elif t % 10 != 0:
		t = t - 1
print(t)


(n, k) = [int(v) for v in input().split()]
while k > 0:
	(dec, surplus) = divmod(n, 10)
	if k <= surplus:
		n -= k
		break
	elif surplus == 0:
		n = n // 10
		k -= 1
	n -= surplus
	k -= surplus
print(n)


def cap(n, k):
	while k > 0:
		if n % 10 < k:
			k -= n % 10
			n = n // 10
			k -= 1
		else:
			n -= k
			break
	return n
(a, b) = tuple(map(int, input().split(' ')))
print(cap(a, b))


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


import cmath
(n, k) = map(int, input().split())
if 2 <= n <= 10 ** 9 and 1 <= k <= 50:
	for i in range(0, k):
		if n % 10 != 0:
			n -= 1
		else:
			n /= 10
	n = int(n)
print(n)


def sub(a, k):
	for i in range(k):
		text = str(a)
		if text[-1] == '0':
			a = a // 10
		else:
			a = a - 1
	return a
(n, k) = map(int, input().split())
print(sub(n, k))


(num, steps) = (int(i) for i in input().split())
for _ in range(steps):
	if num % 10:
		num -= 1
	else:
		num /= 10
print(int(num))


import math
line = input()
n = int(line.split(' ')[0])
k = int(line.split(' ')[1])
for i in range(k):
	if n % 10 != 0:
		n = n - 1
	else:
		n = n / 10
print(math.floor(n))


def WrongSub(Number, Times):
	for i in range(Times):
		if str(Number)[-1] == '0':
			Number //= 10
		else:
			Number -= 1
	return Number
(Number, Times) = list(input().split())
print(WrongSub(int(Number), int(Times)))


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


m = input().split()
n = int(m[0])
k = int(m[1])
for i in range(k):
	s = n % 10
	if s > 0:
		n -= 1
	else:
		n = str(n)
		n = n[:-1]
		n = int(n)
print(n)


import math

def calculate(x, y):
	if y == 0:
		return x
	if x % 10 == 0:
		return calculate(x / 10, y - 1)
	else:
		return calculate(x - 1, y - 1)
(x, y) = map(int, input().split())
n = calculate(x, y)
print(math.floor(n))


import sys
(n, k) = sys.stdin.readline().split()
n = int(n)
k = int(k)
counter = k
for i in range(k):
	if n % 10 != 0:
		n = n - 1
	elif n % 10 == 0:
		n = n / 10
print(int(n))


(num, num_of_sub) = input(' ').split()
num = num
num_int = int(num)
num_of_sub = int(num_of_sub)
for i in range(num_of_sub):
	if num[-1] != '0':
		num_int = int(num_int) - 1
		num = str(num_int)
	else:
		num_int = int(num_int / 10)
		num = str(num_int)
print(int(num_int))


def f(n, end):
	for i in range(end):
		n = n - 1 if n % 10 else n // 10
	return n
(a, b) = map(int, input().split())
print(f(a, b))


(n, k) = map(int, input().split())
if n >= 2 and n <= 1000000000 and (k >= 1) and (k <= 50):
	i = 1
	while i <= k:
		if n % 10 == 0:
			n = n // 10
		else:
			n = n - 1
		i += 1
	print(n)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
s = list(str(n))
s = s[::-1]
i = 0
p = 0
while p <= k:
	p += int(s[i]) + 1
	i += 1
if k - p < 0:
	i -= 1
	g = k - p + int(s[i]) + 1
	s[i] = str(int(s[i]) - g)
print(''.join(s[i:][::-1]))


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


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
(n, k) = read_ints()

def solve(n, k):
	while k != 0:
		last_digit = n % 10
		if last_digit != 0:
			n -= 1
		if last_digit == 0:
			n //= 10
		k -= 1
	return n
print(solve(n, k))


(a, b) = list(map(int, input().split()))
n = 0
while n != b:
	if a % 10 != 0:
		a = a - 1
		n += 1
	elif a % 10 == 0:
		a = a // 10
		n += 1
print(a)


x = input().split()
n = x[1]
m = x[0]
j = int(m)
s = len(m) - 1
for i in range(int(n)):
	if m[s] != '0':
		j = j - 1
		m = str(j)
	elif m[s] == '0':
		j = j / 10
		m = str(j)
		s = s - 1
print(int(j))


import math
data = input().split(' ')
num = int(data[0])
count = int(data[1])
for x in range(0, count):
	if num % 10 != 0:
		num -= 1
	else:
		num /= 10
print(math.floor(num))


import sys, os.path
import math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, k) = map(int, input().split())
while k > 0:
	if n % 10 != 0:
		n -= 1
	else:
		n = n // 10
	k -= 1
print(n)


nAndK = input()

def Convert(string):
	return list(string.split(' '))
nAndK = Convert(nAndK)
nAndK = list(map(int, nAndK))
n = nAndK[0]
k = nAndK[1]
for _ in range(k):
	if n % 10 == 0:
		n //= 10
	else:
		n -= 1
print(n)


(x, y) = map(int, input().split())
a = str(x)
l = len(a)
for n in range(y):
	if a[l - 1] == '0':
		x = x // 10
		a = str(x)
		l = len(a)
	elif a[l - 1] != '0':
		x = x - 1
		a = str(x)
		l = len(a)
print(a)