# Takoma Park M.S.
# Int-3
# Contest 1
# Evan Wang

f = open("1int_testdata.txt", "a")
f.close()

n = 0
p = 0
middle = 0
newDigit = 0
lineList = []
nList = []

f = open("1int_testdata.txt", "r")
for line in f:

  lineList = line.split()
  n = lineList[0]
  p = int(lineList[1])

  middle = int(n[p * (-1)])
  for index in n:
    nList.append(int(index))

  for number in range(len(n)):
    if number < len(n) - p:
      newDigit = nList[number] + middle
      if newDigit >= 10:
        newDigit = newDigit - 10
      print(newDigit, end = "")
    
    elif number == len(n) - p:
      print(middle, end = "")
    
    else:
      newDigit = nList[number] - middle
      if newDigit < 0:
        newDigit = (-1) * newDigit
      print(newDigit, end = "")
  
  nList = []
  print("")

f.close()