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


#-----------------------------------------------
# Main Function to solve the problem
def transform(N,P,D):
  # Save value of N in to a temp variable
  temp = N
  # Initialize count to 1
  count = 1
  # Walk through each base 10 position until we hit the index P from right
  while (N>0 and count= 0 and digit <= 4):
    # Add D to the pth digit
    digit += D
    # Find the units digit
    U = digit - ((digit//10)*10)
    divisor = 1
    N = temp
    for index in range (1, P+1):
      divisor *= 10
    N //= divisor
    N *= divisor
    # Replace pth digit by units digit of the sum and then repplace all digits to the right by 0
    N += divisor*U//10
  # Case 2: Pth digit of N from right is from 5 to 9
  elif (digit >=5 and digit <=9):
    # Subtract D to the pth digit
    digit -= D
    # Find the absolute value of the diff
    digit = abs(digit)
    count = 1
    while (digit>0):
      lm = digit%10
      digit = digit//10
    divisor = 1
    N = temp
    for index in range (1, P+1):
      divisor *= 10
    N //= divisor
    N = (divisor*N)
    # Replace pth digit by left most digit of the difference and replace all digits to the right by 0
    N += lm*(divisor)//10
  # Return the transformed value
  return N


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