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


#-----------------------------------------------
# Main Function to solve the problem
def transform(N,P,D):
    count = P
    dig =[]
    while(N>0):
        
        dig.append(N%10)
        N=N//10
        count = count-1
        if count == 0:
            NewN = N
            #print(N)

    if dig[P-1]<5:
        Y = dig[P-1] + D
        dig[P-1] = Y%10

    if dig[P-1]>=5:
        Y = abs(dig[P-1] - D)
        while(Y>0):
            dig[P-1] = Y
            Y = Y//10
    #print (dig[P-1])
    NewN = (NewN*10 + dig[P-1])*(10**(P-1))
    #print(NewN)
    return(NewN)
    

#-----------------------------------------------
# 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 = transform(N, P, D)
    writeoutput(out)