# Christina Kaddouh
# Bergen County Academies
# Junior Division

text_file = open("jr-sample-input.txt", "r")
count = 0

for line in text_file:
    count += 1

    lineList = line.split()
    N = lineList[0].strip()
    P = int(lineList[1].strip())
    D = int(lineList[2].strip())

    nList = []
    for i in N:
        nList.append(int(i))

    num = nList[-P]

    if 0 <= num <= 4:
        nList[-P] = (num + D) % 10
        for i in range(len(nList)-P + 1, len(nList)):
            nList[i] = 0

    if 5 <= num <= 9:
        strNum = str(abs(num - D))
        strNumList = []
        for i in strNum:
            strNumList.append(int(i))
        nList[-P] = strNumList[0]

        for i in range(len(nList)-P + 1, len(nList)):
            nList[i] = 0
    print(count, end = ". ")
    for i in nList:
        print(i, end = "")
    print()