with open('1int_testdata.txt') as a:
    b=a.readline()
    while b:
        wasabe=b
        afters=wasabe.split(' ')
        n=(afters[0])
        #print(n)
        p=int(afters[1])
        #print(p)
        b=a.readline()
        nc=n[-p]
        h=int(nc)
        #print(nc)
        digits=n[0:-p]
        #print(digits)
        digits1=n[-p+1:]
        #print(digits1)
        l=list(digits)
        k=list(digits1)
        m=list(n)
        if l==m:
            l=l[0:0]
            #print(l)
        else:
            #print(l)
            l=l
        if k==m:
            k=k[0:0]
            #print(k)
        else:
            #print(k)
            k=k
        sNew=''
        sNew=sNew.join(l)
        #print(sNew)
        sNew1=''
        sNew1=sNew1.join(k)
        #print(sNew1)
        rf=map(int,l)

        rb=map(int,k)

        ffront=[i+h for i in rf]
        #print(ffront)
        lastfront=[i%10 for i in ffront]
        #print(list(lastfront))

        fgh=[str(x) for x in lastfront]
        #print(fgh)

        fback=[i-h for i in rb]
        #print(fback)
        lastback=map(abs,fback)
        #print(list(lastback))

        abc=[str(x) for x in lastback]
        #print(abc)

        content=''.join(fgh)
        #print(content)
        content1=''.join(abc)
        #print(content1)
        
        fgh1=[str(x) for x in content]
        #print(fgh1)
        abc1=[str(x) for x in content1]
        #print(abc1)

        e=[str(x) for x in nc]

        qwe=fgh1+e+abc1
        #print(qwe)

        asd=''.join(qwe)
        print(asd)