# -----------------------------------------------------------------------------------------
# Oak Valley Coding Club 2019-2020
# Solution for 2020 ACSL Programming Problem #1 – Junior Division
# Author :  Aadit	Mathur
# Language: Python 3.x
# -----------------------------------------------------------------------------------------

# Main Function to solve the problem
def npd(N, P, D):
    pos = -P
    Nlist = list(str(N))
    if int(Nlist[pos]) in range(5):
        Nlist[pos] = list(str(int(Nlist[pos]) + D))[-1]
    elif int(Nlist[pos]) in range(5, 10):
        Nlist[pos] = list(str(abs(int(Nlist[pos]) - D)))[0]

    count = -1
    while count > pos:
        Nlist[count] = '0'
        count -= 1
    return ''.join(Nlist)


# Auxiliary code for reading input and writing output
input = 'input.txt'
output = 'output.txt'

def readinput():
  words=[]
  with open(input) as f:
    lines = f.readlines()
    for line in lines:
      if line.split()!=[]:
        words.append(line.split())

  for j in range (0,len(words)):
    for i in range(0,len(words[j])):
      words[j][i]=int(words[j][i])

  return words


def writeoutput(line):
  with open(output,'a') as f:
     f.write(str(line)+'\n')

def clearoutput():
  f=open(output,'w')
  f.write('')

allinputs = readinput()

clearoutput()
for line in allinputs:
    N = line[0]
    P = line[1]
    D = line[2]
    out = npd(N, P, D)
    writeoutput(out)