Little Praneet loves experimenting with algorithms and has devised a new algorithm. The algorithm is performed on an integer as follows:
- if the rearmost digit is $0$, he will erase it.
- else, he will replace the rearmost digit $d$ with $d-1$.
If a point comes when the integer becomes $0$, the algorithm stops.
You are given an integer $n$. Praneet will perform the algorithm on it $a$ times. You have to print the result after $a$ operations.

-----Input:-----
- The first and only line of input contains two integers $n$ — initial number, and $a$ —the number of operations.

-----Output:-----
- Print one integer — the result of performing the algorithm on $n$ $a$ times.

-----Constraints-----
- $2 \leq n \leq 10^9$
- $1 \leq a \leq 50$

-----Sample Input 1-----
1001 2

-----Sample Input 2-----
5 2

-----Sample Output 1-----
100

-----Sample Output 2-----
3

-----Explanation-----
- In the first example, the transformation is as follows: $1001->1000->100$.
- In the second example, the transformation is as follows: $5->4->3$.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
n,a=map(int,input().split())
for i in range(a):
 if(n%10==0):
  n=n//10
 else:
  n=n-1
  
print(n)

# cook your dish here
a,b=map(int,input().split())
for i in range(b):
 r=a%10
 n=a//10
 if(r==0):
  a=n
 else:
  a=a-1
print(a)

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



# cook your dish here
m , n = input().split()
for i in range(int(n)):
 if m[-1] == '0':
  m = m[:len(m)-1]
 else:
  b = int(m[-1])-1
  m = m[:len(m)-1]+str(b)
print(int(m))


n,a=list(map(int,input().split()))
n=list(map(int,str(n)))
for i in range(a):
 if(n[-1]==0):
  n.pop()
 else:
  n[-1]-=1
 if(len(n)==0):
  break
if(len(n)==1):
 print(int(n[0]))
elif(len(n)==0):
 print(0)
else:
 n=list(map(str,n))
 print(int("".join(n)))


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

# cook your dish here
n,k=map(int,input().split())
while n!=1 and k:
 if n%10==0:
  n//=10
 else:
  n-=1
 k-=1
print(n)


#def solve():
 
'''while test:
    solve()
    test-=1'''

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

# cook your dish here
n,a=list(map(int,input().split()))
for _ in range(a):
 if n == 0:
  break
 elif str(n)[-1] == "0":
  n = n//10
 else:
  n = n-1
print(str(n)+"\n")


# cook your dish here
n,op = map(int,input().split())
for i in range(op):
 if n%10 ==0:
  n =n//10
 else:
  n =n-1
print(n)

n,a =input().split()
a=int(a)
s=str(n)
#print(type(s[len(s)-1]))
while(a>0):
 if(s[len(s)-1]=="0"):
  s=s[:len(s)-1]
 else:
  s1=str((int(s[len(s)-1]))-1)
  s=s[:len(s)-1]
  s=s+s1
 a=a-1
print(int(s))
  


def chef(a,n):
 while n>0:
  if a[-1]=="0":
   a=a[:-1]
   n-=1
  else:
   a=str(int(a)-1)
   n-=1
 return a
b=list(map(str,input().split()))
print(chef(b[0],int(b[1])))

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

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

# cook your dish here
n,a=list(map(int,input().split()))
while a!=0:
 if n%10==0:
  n=n//10
 else:
  n-=1
 a-=1
print(n)


# cook your dish here
(n,a)=map(int,input().split(' '))
while a:
 if n%10==0:
  n=n//10
 else:
  n-=1
 a-=1
print(n)

na = list(map(int,input().split()))
n = na[0]
a = na[1]

n = str(n)
n = list(map(int,n))
for i in range(a):
 if n[-1] == 0:
  n.pop()
 else:
  n[-1] -= 1

print(int(''.join(list(map(str,n)))))


# cook your dish here
try:
 n,k=map(int,input().split(" "))
 while(k>0):
  if(n%10==0):
   n=n//10
  else:
   n=n-1
  k=k-1
  if(n==0):
   break
  
 print(n)
except EOFError as e:
 print(e)

# cook your dish here
n,a=map(int,input().split())
for i in range(a):
 if n!= 0:
  r=n%10
  n=n//10
  if r!=0:
   r-=1
   n=n*10+r
print(int(n))

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


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

# cook your dish here
ab=input().split(' ')
a=ab[0]
b=int(ab[1])
aa=[]
for x in str(a):
 aa.append(int(x))
while b>0:
  
  if len(aa)==1 and aa[0]==0:
   break
  else:
   if aa[-1]==0:
    
    del(aa[-1])
    
   else:
    
    aa[-1]=int(aa[-1])-1
  b-=1 
for x in aa:
 print(x,end='')


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

# cook your dish here
n,a = map(int,input().split())
while(a):
 a=a-1
 if n%10==0:
  n=n//10
 else:
  n=n-1
 if n==0:
  break
print(n)