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


#-----------------------------------------------
# Main Function to solve the problem
def transform(N,P,D):
    len_N = len(str(N))
    Nstring = str(N)
    length = len(Nstring)
    Pright = Nstring[len_N - P]
    oPright = Pright
    if ((int(Pright)>=0) and (int(Pright)<=4)):
        Pright = int(Pright) + D
        len_Pright = len(str(Pright))
        unit = int(len_Pright) - 1
        PrightString = str(Pright)
        newPright = PrightString[unit]
        a = len_N - P
        Nstring = list(Nstring)
        Nstring[a] = newPright
        for i in range(len_N-P+1,len_N):
            Nstring[i] = '0'
        N_transformed = N
    elif ((int(Pright)>=5) and (int(Pright)<=9)):
        Pright = int(Pright) - D
        Pright = abs(int(Pright))
        PrightString = str(Pright)
        newPright = PrightString[0]
        a = len_N - P
        Nstring = list(Nstring)
        Nstring[a] = newPright
        for i in range(len_N-P+1,len_N):
            Nstring[i] = '0'
        
    Nstring = "".join(Nstring)
    N_transformed = Nstring
    return N_transformed



#-----------------------------------------------
# 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)