# Takoma Park M.S.
# Jr-5
# Contest 1
# Sameer Mehta

# input file
FILE_NAME = "1jr_testdata.txt"

# open file
with open(FILE_NAME) as f:

    # for every line in the file
    for line in f:

        # strip and split the line into a list
        line = line.strip().split()

        # convert n into a list of integers
        n = list(line[0])
        for i in range(len(n)):
            n[i] = int(n[i])

        # assign the rest of the variables
        p = int(line[1])
        d = int(line[2])

        # check if the pth digit from the right is less than or equal to 4
        if n[-p] <= 4:

            # replace with the units digit of the sum of this digit and d
            n[-p] = (n[-p] + d) % 10
            
        # otherwise
        else:

            # replace with the first digit of the absolute difference of this digit and d
            n[-p] = int(str(abs(n[-p] - d))[0])

        # replace all values after the pth position with zeroes
        for i in range(len(n)-p+1,len(n)):
            n[i]=0

        # print the result
        for digit in n: 
            print(digit, end="")
        print()