"""
Takoma Park M.S.
Jr-5
Contest 1
Nicholas Khil
"""

f = open("1jr_testdata.txt", "r")

for line in f:
    lineList = line.split(" ")
    number = lineList[0]
    numList = []
    numList[:0] = number
    pos = len(numList) - int(lineList[1])
    transition = lineList[2]
    final = ""

    if int(numList[pos]) > 4:
        dif = abs(int(numList[pos]) - int(transition))
        temp = []
        temp[:0] = str(dif)
        rep = temp[0]
    else:
        add = (int(numList[pos]) + int(transition))
        while add >= 10:
            add -= 10
        rep = add

    numList[pos] = str(rep)
    
    for i in range(pos+1, len(numList)):
        numList[i] = "0"

    for x in numList:
        final += str(x)
    print(final)

input()